1 /* 2 * Copyright (c) 2022 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_ICONNECTION_OBSERVER_H 17 #define OHOS_ABILITYRUNTIME_ICONNECTION_OBSERVER_H 18 19 #include "connection_data.h" 20 #include "dlp_state_data.h" 21 #include "iremote_broker.h" 22 23 namespace OHOS { 24 namespace AbilityRuntime { 25 /** 26 * @class IConnectionObserver 27 * IConnectionObserver is used to notify connection relationship of extension component. 28 */ 29 class IConnectionObserver : public OHOS::IRemoteBroker { 30 public: 31 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.abilityruntime.connectionobserver"); 32 33 /** 34 * called when extension was connected. 35 * 36 * @param data connection relationship data. 37 */ 38 virtual void OnExtensionConnected(const ConnectionData &data) = 0; 39 40 /** 41 * called when extension was disconnected. 42 * 43 * @param data connection relationship data. 44 */ 45 virtual void OnExtensionDisconnected(const ConnectionData &data) = 0; 46 47 /** 48 * called when dlp ability was started. 49 * 50 * @param data dlp state data. 51 */ 52 virtual void OnDlpAbilityOpened(const DlpStateData &data) = 0; 53 54 /** 55 * called when dlp ability was terminated. 56 * 57 * @param data dlp state data. 58 */ 59 virtual void OnDlpAbilityClosed(const DlpStateData &data) = 0; 60 61 enum ConnectionObserverCmd { 62 // ipc id for OnExtensionConnected 63 ON_EXTENSION_CONNECTED = 0, 64 65 // ipc id for OnExtensionDisconnected 66 ON_EXTENSION_DISCONNECTED, 67 68 // ipc id for OnDlpAbilityOpened 69 ON_DLP_ABILITY_OPENED, 70 71 // ipc id for OnExtensionDisconnected 72 ON_DLP_ABILITY_CLOSED, 73 74 // maximum of enum 75 CMD_MAX 76 }; 77 }; 78 } // namespace AbilityRuntime 79 } // namespace OHOS 80 #endif // OHOS_ABILITYRUNTIME_ICONNECTION_OBSERVER_H 81