1 /*
2  * Copyright (c) 2022-2024 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 ACCESSTOKEN_CALLBACK_STUBS_H
17 #define ACCESSTOKEN_CALLBACK_STUBS_H
18 
19 
20 #include "i_permission_state_callback.h"
21 #ifdef TOKEN_SYNC_ENABLE
22 #include "i_token_sync_callback.h"
23 #endif // TOKEN_SYNC_ENABLE
24 #include "iremote_stub.h"
25 #include "nocopyable.h"
26 
27 namespace OHOS {
28 namespace Security {
29 namespace AccessToken {
30 class PermissionStateChangeCallbackStub : public IRemoteStub<IPermissionStateCallback> {
31 public:
32     PermissionStateChangeCallbackStub() = default;
33     virtual ~PermissionStateChangeCallbackStub() = default;
34 
35     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
36 };
37 
38 #ifdef TOKEN_SYNC_ENABLE
39 class TokenSyncCallbackStub : public IRemoteStub<ITokenSyncCallback> {
40 public:
41     TokenSyncCallbackStub() = default;
42     virtual ~TokenSyncCallbackStub() = default;
43 
44     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
45 private:
46     void GetRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply);
47     void DeleteRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply);
48     void UpdateRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply);
49     bool IsAccessTokenCalling() const;
50 };
51 #endif // TOKEN_SYNC_ENABLE
52 } // namespace AccessToken
53 } // namespace Security
54 } // namespace OHOS
55 #endif // ACCESSTOKEN_CALLBACK_STUBS_H
56