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 ABILITY_RUNTIME_CONNECTION_OBSERVER_H
17 #define ABILITY_RUNTIME_CONNECTION_OBSERVER_H
18 
19 #include "connection_data.h"
20 #include "dlp_state_data.h"
21 
22 namespace OHOS {
23 namespace AbilityRuntime {
24 /**
25  * @class ConnectionObserver
26  * ConnectionObserver is used to notify connection relationship of extension component.
27  */
28 class ConnectionObserver {
29 public:
30     /**
31      * @brief Constructor.
32      *
33      */
34     ConnectionObserver() = default;
35 
36     /**
37      * @brief Destructor.
38      *
39      */
40     virtual ~ConnectionObserver() = default;
41 
42     /**
43      * called when extension was connected.
44      *
45      * @param data connection relationship data.
46      */
47     virtual void OnExtensionConnected(const ConnectionData& data) = 0;
48 
49     /**
50      * called when extension was disconnected.
51      *
52      * @param data connection relationship data.
53      */
54     virtual void OnExtensionDisconnected(const ConnectionData& data) = 0;
55 
56     /**
57      * called when dlp ability was started.
58      *
59      * @param data dlp state data.
60      */
61     virtual void OnDlpAbilityOpened(const DlpStateData& data) = 0;
62 
63     /**
64      * called when dlp ability was terminated.
65      *
66      * @param data dlp state data.
67      */
68     virtual void OnDlpAbilityClosed(const DlpStateData& data) = 0;
69 
70     /**
71      * called when service was died.
72      *
73      */
OnServiceDied()74     virtual void OnServiceDied() {}
75 };
76 } // namespace AbilityRuntime
77 } // namespace OHOS
78 #endif // ABILITY_RUNTIME_CONNECTION_OBSERVER_H
79