1 /* 2 * Copyright (c) 2022-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 OHOS_ABILITYRUNTIME_CONNECTION_OBSERVER_PROXY_H 17 #define OHOS_ABILITYRUNTIME_CONNECTION_OBSERVER_PROXY_H 18 19 #include <string> 20 21 #include "iconnection_observer.h" 22 #include "iremote_proxy.h" 23 24 namespace OHOS { 25 namespace AbilityRuntime { 26 /** 27 * interface for connection observer. 28 */ 29 class ConnectionObserverProxy : public IRemoteProxy<IConnectionObserver> { 30 public: ConnectionObserverProxy(const sptr<IRemoteObject> & impl)31 explicit ConnectionObserverProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IConnectionObserver>(impl) {} 32 33 virtual ~ConnectionObserverProxy() = default; 34 35 virtual void OnExtensionConnected(const ConnectionData &connectionData) override; 36 37 virtual void OnExtensionDisconnected(const ConnectionData &connectionData) override; 38 39 #ifdef WITH_DLP 40 virtual void OnDlpAbilityOpened(const DlpStateData &dlpData) override; 41 42 virtual void OnDlpAbilityClosed(const DlpStateData &dlpData) override; 43 #endif // WITH_DLP 44 45 private: 46 static inline BrokerDelegator<ConnectionObserverProxy> delegator_; 47 int SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); 48 }; 49 } // namespace AbilityRuntime 50 } // namespace OHOS 51 #endif // OHOS_ABILITYRUNTIME_CONNECTION_OBSERVER_PROXY_H 52