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 bool HasDataType(const std::string &mimeType) override; 40 virtual void SubscribeObserver(PasteboardObserverType type, 41 const sptr<IPasteboardChangedObserver> &observer) override; 42 virtual void UnsubscribeObserver(PasteboardObserverType type, 43 const sptr<IPasteboardChangedObserver> &observer) override; 44 virtual void UnsubscribeAllObserver(PasteboardObserverType type) override; 45 virtual int32_t SetGlobalShareOption(const std::map<uint32_t, ShareOption> &globalShareOptions) override; 46 virtual int32_t RemoveGlobalShareOption(const std::vector<uint32_t> &tokenIds) override; 47 virtual std::map<uint32_t, ShareOption> GetGlobalShareOption(const std::vector<uint32_t> &tokenIds) override; 48 virtual int32_t SetAppShareOptions(const ShareOption &shareOptions) override; 49 virtual int32_t RemoveAppShareOptions() override; 50 virtual void PasteStart(const std::string &pasteId) override; 51 virtual void PasteComplete(const std::string &deviceId, const std::string &pasteId) override; 52 virtual int32_t RegisterClientDeathObserver(sptr<IRemoteObject> observer) override; 53 54 private: 55 static inline BrokerDelegator<PasteboardServiceProxy> delegator_; 56 void ProcessObserver(uint32_t code, PasteboardObserverType type, 57 const sptr<IPasteboardChangedObserver> &observer); 58 static constexpr int32_t MAX_GET_GLOBAL_SHARE_OPTION_SIZE = 2000; 59 }; 60 } // namespace MiscServices 61 } // namespace OHOS 62 #endif // PASTE_BOARD_SERVICE_PROXY_H