• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 POWERMGR_POWER_MANAGER_SHUTDOWN_PROXY_H
17 #define POWERMGR_POWER_MANAGER_SHUTDOWN_PROXY_H
18 
19 #include <utility>
20 
21 #include "ipower_mgr.h"
22 #include "iremote_object.h"
23 
24 namespace OHOS {
25 namespace PowerMgr {
26 class ShutdownProxyDelegator {
27 public:
ShutdownProxyDelegator(const sptr<IRemoteObject> & remote,std::u16string descriptor)28     ShutdownProxyDelegator(const sptr<IRemoteObject>& remote, std::u16string descriptor)
29         : remote_(remote), descriptor_(std::move(descriptor))
30     {
31     }
32     virtual ~ShutdownProxyDelegator() = default;
33 
34     void RegisterShutdownCallback(const sptr<ITakeOverShutdownCallback>& callback, ShutdownPriority priority);
35     void UnRegisterShutdownCallback(const sptr<ITakeOverShutdownCallback>& callback);
36 
37     void RegisterShutdownCallback(const sptr<IAsyncShutdownCallback>& callback, ShutdownPriority priority);
38     void UnRegisterShutdownCallback(const sptr<IAsyncShutdownCallback>& callback);
39     void RegisterShutdownCallback(const sptr<ISyncShutdownCallback>& callback, ShutdownPriority priority);
40     void UnRegisterShutdownCallback(const sptr<ISyncShutdownCallback>& callback);
41 
42 private:
43     sptr<IRemoteObject> remote_;
44     std::u16string descriptor_;
45 };
46 } // namespace PowerMgr
47 } // namespace OHOS
48 
49 #endif // POWERMGR_POWER_MANAGER_SHUTDOWN_PROXY_H
50