• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "connection_observer_stub_impl.h"
17 
18 #include "connection_observer_client_impl.h"
19 
20 namespace OHOS {
21 namespace AbilityRuntime {
OnExtensionConnected(const ConnectionData & data)22 void ConnectionObserverStubImpl::OnExtensionConnected(const ConnectionData &data)
23 {
24     auto owner = owner_.lock();
25     if (!owner) {
26         return;
27     }
28     owner->HandleExtensionConnected(data);
29 }
30 
OnExtensionDisconnected(const ConnectionData & data)31 void ConnectionObserverStubImpl::OnExtensionDisconnected(const ConnectionData &data)
32 {
33     auto owner = owner_.lock();
34     if (!owner) {
35         return;
36     }
37     owner->HandleExtensionDisconnected(data);
38 }
39 
OnExtensionSuspended(const ConnectionData & data)40 void ConnectionObserverStubImpl::OnExtensionSuspended(const ConnectionData &data)
41 {
42     auto owner = owner_.lock();
43     if (!owner) {
44         return;
45     }
46     owner->HandleExtensionSuspended(data);
47 }
48 
OnExtensionResumed(const ConnectionData & data)49 void ConnectionObserverStubImpl::OnExtensionResumed(const ConnectionData &data)
50 {
51     auto owner = owner_.lock();
52     if (!owner) {
53         return;
54     }
55     owner->HandleExtensionResumed(data);
56 }
57 
58 #ifdef WITH_DLP
OnDlpAbilityOpened(const DlpStateData & data)59 void ConnectionObserverStubImpl::OnDlpAbilityOpened(const DlpStateData &data)
60 {
61     auto owner = owner_.lock();
62     if (!owner) {
63         return;
64     }
65     owner->HandleDlpAbilityOpened(data);
66 }
67 
OnDlpAbilityClosed(const DlpStateData & data)68 void ConnectionObserverStubImpl::OnDlpAbilityClosed(const DlpStateData &data)
69 {
70     auto owner = owner_.lock();
71     if (!owner) {
72         return;
73     }
74     owner->HandleDlpAbilityClosed(data);
75 }
76 #endif // WITH_DLP
77 }  // namespace AbilityRuntime
78 }  // namespace OHOS
79