1 /* 2 * Copyright (C) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef PASTE_BOARD_SERVICE_PROXY_H 17 #define PASTE_BOARD_SERVICE_PROXY_H 18 19 #include "i_pasteboard_observer.h" 20 #include "i_pasteboard_service.h" 21 #include "iremote_proxy.h" 22 23 namespace OHOS { 24 namespace MiscServices { 25 class PasteboardServiceProxy : public IRemoteProxy<IPasteboardService> { 26 public: 27 explicit PasteboardServiceProxy(const sptr<IRemoteObject> &object); 28 ~PasteboardServiceProxy() = default; 29 DISALLOW_COPY_AND_MOVE(PasteboardServiceProxy); 30 virtual void Clear() override; 31 virtual int32_t GetRecordValueByType(uint32_t dataId, uint32_t recordId, PasteDataEntry &value) override; 32 virtual int32_t GetPasteData(PasteData &data, int32_t &syncTime) override; 33 virtual bool HasPasteData() override; 34 virtual std::set<Pattern> DetectPatterns(const std::set<Pattern> &patternsToCheck) override; 35 virtual int32_t SetPasteData(PasteData &pasteData, const sptr<IPasteboardDelayGetter> delayGetter, 36 const sptr<IPasteboardEntryGetter> entryGetter) override; 37 virtual bool IsRemoteData() override; 38 virtual int32_t GetDataSource(std::string &bundleName) override; 39 virtual std::vector<std::string> GetMimeTypes() override; 40 virtual bool HasDataType(const std::string &mimeType) override; 41 virtual void SubscribeObserver(PasteboardObserverType type, 42 const sptr<IPasteboardChangedObserver> &observer) override; 43 virtual void UnsubscribeObserver(PasteboardObserverType type, 44 const sptr<IPasteboardChangedObserver> &observer) override; 45 virtual void UnsubscribeAllObserver(PasteboardObserverType type) override; 46 virtual int32_t SetGlobalShareOption(const std::map<uint32_t, ShareOption> &globalShareOptions) override; 47 virtual int32_t RemoveGlobalShareOption(const std::vector<uint32_t> &tokenIds) override; 48 virtual std::map<uint32_t, ShareOption> GetGlobalShareOption(const std::vector<uint32_t> &tokenIds) override; 49 virtual int32_t SetAppShareOptions(const ShareOption &shareOptions) override; 50 virtual int32_t RemoveAppShareOptions() override; 51 virtual void PasteStart(const std::string &pasteId) override; 52 virtual void PasteComplete(const std::string &deviceId, const std::string &pasteId) override; 53 virtual int32_t RegisterClientDeathObserver(sptr<IRemoteObject> observer) override; 54 55 private: 56 static inline BrokerDelegator<PasteboardServiceProxy> delegator_; 57 void ProcessObserver(uint32_t code, PasteboardObserverType type, 58 const sptr<IPasteboardChangedObserver> &observer); 59 static constexpr int32_t MAX_GET_GLOBAL_SHARE_OPTION_SIZE = 2000; 60 }; 61 } // namespace MiscServices 62 } // namespace OHOS 63 #endif // PASTE_BOARD_SERVICE_PROXY_H