1fc0b0055Sopenharmony_ci/*
2fc0b0055Sopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3fc0b0055Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fc0b0055Sopenharmony_ci * you may not use this file except in compliance with the License.
5fc0b0055Sopenharmony_ci * You may obtain a copy of the License at
6fc0b0055Sopenharmony_ci *
7fc0b0055Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fc0b0055Sopenharmony_ci *
9fc0b0055Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fc0b0055Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fc0b0055Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fc0b0055Sopenharmony_ci * See the License for the specific language governing permissions and
13fc0b0055Sopenharmony_ci * limitations under the License.
14fc0b0055Sopenharmony_ci */
15fc0b0055Sopenharmony_ci
16fc0b0055Sopenharmony_ci#ifndef ACCESSTOKEN_CALLBACKS_H
17fc0b0055Sopenharmony_ci#define ACCESSTOKEN_CALLBACKS_H
18fc0b0055Sopenharmony_ci
19fc0b0055Sopenharmony_ci
20fc0b0055Sopenharmony_ci#include "accesstoken_callback_stubs.h"
21fc0b0055Sopenharmony_ci#include "perm_state_change_callback_customize.h"
22fc0b0055Sopenharmony_ci#ifdef TOKEN_SYNC_ENABLE
23fc0b0055Sopenharmony_ci#include "token_sync_kit_interface.h"
24fc0b0055Sopenharmony_ci#endif // TOKEN_SYNC_ENABLE
25fc0b0055Sopenharmony_ci
26fc0b0055Sopenharmony_cinamespace OHOS {
27fc0b0055Sopenharmony_cinamespace Security {
28fc0b0055Sopenharmony_cinamespace AccessToken {
29fc0b0055Sopenharmony_ciclass PermissionStateChangeCallback : public PermissionStateChangeCallbackStub {
30fc0b0055Sopenharmony_cipublic:
31fc0b0055Sopenharmony_ci    explicit PermissionStateChangeCallback(const std::shared_ptr<PermStateChangeCallbackCustomize>& customizedCallback);
32fc0b0055Sopenharmony_ci    ~PermissionStateChangeCallback() override;
33fc0b0055Sopenharmony_ci
34fc0b0055Sopenharmony_ci    void PermStateChangeCallback(PermStateChangeInfo& result) override;
35fc0b0055Sopenharmony_ci
36fc0b0055Sopenharmony_ci    void Stop();
37fc0b0055Sopenharmony_ci
38fc0b0055Sopenharmony_ciprivate:
39fc0b0055Sopenharmony_ci    std::shared_ptr<PermStateChangeCallbackCustomize> customizedCallback_;
40fc0b0055Sopenharmony_ci};
41fc0b0055Sopenharmony_ci
42fc0b0055Sopenharmony_ci#ifdef TOKEN_SYNC_ENABLE
43fc0b0055Sopenharmony_ciclass TokenSyncCallback : public TokenSyncCallbackStub {
44fc0b0055Sopenharmony_cipublic:
45fc0b0055Sopenharmony_ci    explicit TokenSyncCallback(const std::shared_ptr<TokenSyncKitInterface>& tokenSyncCallback);
46fc0b0055Sopenharmony_ci    ~TokenSyncCallback() override;
47fc0b0055Sopenharmony_ci
48fc0b0055Sopenharmony_ci    int32_t GetRemoteHapTokenInfo(const std::string& deviceID, AccessTokenID tokenID) override;
49fc0b0055Sopenharmony_ci    int32_t DeleteRemoteHapTokenInfo(AccessTokenID tokenID) override;
50fc0b0055Sopenharmony_ci    int32_t UpdateRemoteHapTokenInfo(const HapTokenInfoForSync& tokenInfo) override;
51fc0b0055Sopenharmony_ci
52fc0b0055Sopenharmony_ciprivate:
53fc0b0055Sopenharmony_ci    std::shared_ptr<TokenSyncKitInterface> tokenSyncCallback_;
54fc0b0055Sopenharmony_ci};
55fc0b0055Sopenharmony_ci#endif // TOKEN_SYNC_ENABLE
56fc0b0055Sopenharmony_ci} // namespace AccessToken
57fc0b0055Sopenharmony_ci} // namespace Security
58fc0b0055Sopenharmony_ci} // namespace OHOS
59fc0b0055Sopenharmony_ci#endif // ACCESSTOKEN_CALLBACKS_H
60