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_service.h" 20 #include "iremote_proxy.h" 21 22 namespace OHOS { 23 namespace MiscServices { 24 class PasteboardServiceProxy : public IRemoteProxy<IPasteboardService> { 25 public: 26 explicit PasteboardServiceProxy(const sptr<IRemoteObject> &object); 27 ~PasteboardServiceProxy() = default; 28 DISALLOW_COPY_AND_MOVE(PasteboardServiceProxy); 29 virtual void Clear() override; 30 virtual int32_t GetRecordValueByType(uint32_t dataId, uint32_t recordId, PasteDataEntry &value) override; 31 virtual int32_t GetPasteData(PasteData &data, int32_t &syncTime) override; 32 virtual bool HasPasteData() override; 33 virtual std::set<Pattern> DetectPatterns(const std::set<Pattern> &patternsToCheck) override; 34 virtual int32_t SetPasteData(PasteData &pasteData, const sptr<IPasteboardDelayGetter> delayGetter, 35 const sptr<IPasteboardEntryGetter> entryGetter) override; 36 virtual bool IsRemoteData() override; 37 virtual int32_t GetDataSource(std::string &bundleName) override; 38 virtual int32_t SubscribeEntityObserver( 39 EntityType entityType, uint32_t expectedDataLength, const sptr<IEntityRecognitionObserver> &observer) override; 40 virtual int32_t UnsubscribeEntityObserver( 41 EntityType entityType, uint32_t expectedDataLength, const sptr<IEntityRecognitionObserver> &observer) override; 42 virtual std::vector<std::string> GetMimeTypes() override; 43 virtual bool HasDataType(const std::string &mimeType) override; 44 virtual void SubscribeObserver(PasteboardObserverType type, 45 const sptr<IPasteboardChangedObserver> &observer) override; 46 virtual void UnsubscribeObserver(PasteboardObserverType type, 47 const sptr<IPasteboardChangedObserver> &observer) override; 48 virtual void UnsubscribeAllObserver(PasteboardObserverType type) override; 49 virtual int32_t SetGlobalShareOption(const std::map<uint32_t, ShareOption> &globalShareOptions) override; 50 virtual int32_t RemoveGlobalShareOption(const std::vector<uint32_t> &tokenIds) override; 51 virtual std::map<uint32_t, ShareOption> GetGlobalShareOption(const std::vector<uint32_t> &tokenIds) override; 52 virtual int32_t SetAppShareOptions(const ShareOption &shareOptions) override; 53 virtual int32_t RemoveAppShareOptions() override; 54 virtual void PasteStart(const std::string &pasteId) override; 55 virtual void PasteComplete(const std::string &deviceId, const std::string &pasteId) override; 56 virtual int32_t GetRemoteDeviceName(std::string &deviceName, bool &isRemote) override; 57 virtual void ShowProgress(const std::string &progressKey, const sptr<IRemoteObject> &observer) override; 58 virtual int32_t RegisterClientDeathObserver(sptr<IRemoteObject> observer) override; 59 virtual int32_t GetChangeCount(uint32_t &changeCount) override; 60 61 private: 62 static inline BrokerDelegator<PasteboardServiceProxy> delegator_; 63 void ProcessObserver(uint32_t code, PasteboardObserverType type, const sptr<IPasteboardChangedObserver> &observer); 64 static constexpr int32_t MAX_GET_GLOBAL_SHARE_OPTION_SIZE = 2000; 65 }; 66 } // namespace MiscServices 67 } // namespace OHOS 68 #endif // PASTE_BOARD_SERVICE_PROXY_H