/* * Copyright (C) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef WEB_CLIPBORD_CONTROLLER_H #define WEB_CLIPBORD_CONTROLLER_H #include #include #include #include #include #include "paste_data.h" #include "paste_data_record.h" #include "pasteboard_client.h" #include "refbase.h" namespace OHOS { namespace NWeb { class WebClipboardController : public RefBase { public: WebClipboardController() {}; ~WebClipboardController() {}; static WebClipboardController& GetInstance(); std::shared_ptr SplitHtml(std::shared_ptr html) noexcept; std::shared_ptr RebuildHtml(std::shared_ptr pasteData) noexcept; private: std::vector> SplitHtmlWithImgLabel( const std::shared_ptr html) noexcept; std::map> SplitHtmlWithImgSrcLabel( const std::vector>& matchVec) noexcept; std::shared_ptr BuildPasteData( std::shared_ptr html, const std::map>& imgSrcMap) noexcept; void RemoveAllRecord(std::shared_ptr pasteData) noexcept; bool IsLocalURI(std::string& uri) noexcept; }; } // namespace NWeb } // namespace OHOS #endif // WEB_CLIPBORD_CONTROLLER_H