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_PROXYS_H 17 #define ACCESSTOKEN_CALLBACK_PROXYS_H 18 19 #include "i_permission_state_callback.h" 20 #ifdef TOKEN_SYNC_ENABLE 21 #include "i_token_sync_callback.h" 22 #endif // TOKEN_SYNC_ENABLE 23 24 #include "iremote_proxy.h" 25 #include "nocopyable.h" 26 #include "permission_state_change_info.h" 27 28 namespace OHOS { 29 namespace Security { 30 namespace AccessToken { 31 class PermissionStateChangeCallbackProxy : public IRemoteProxy<IPermissionStateCallback> { 32 public: 33 explicit PermissionStateChangeCallbackProxy(const sptr<IRemoteObject>& impl); 34 ~PermissionStateChangeCallbackProxy() override; 35 virtual void PermStateChangeCallback(PermStateChangeInfo& result) override; 36 37 private: 38 static inline BrokerDelegator<PermissionStateChangeCallbackProxy> delegator_; 39 }; 40 41 #ifdef TOKEN_SYNC_ENABLE 42 class TokenSyncCallbackProxy : public IRemoteProxy<ITokenSyncCallback> { 43 public: 44 explicit TokenSyncCallbackProxy(const sptr<IRemoteObject>& impl); 45 ~TokenSyncCallbackProxy() override; 46 int32_t GetRemoteHapTokenInfo(const std::string& deviceID, AccessTokenID tokenID) override; 47 int32_t DeleteRemoteHapTokenInfo(AccessTokenID tokenID) override; 48 int32_t UpdateRemoteHapTokenInfo(const HapTokenInfoForSync& tokenInfo) override; 49 50 private: 51 static inline BrokerDelegator<TokenSyncCallbackProxy> delegator_; 52 }; 53 #endif // TOKEN_SYNC_ENABLE 54 } // namespace AccessToken 55 } // namespace Security 56 } // namespace OHOS 57 #endif // ACCESSTOKEN_CALLBACK_PROXYS_H 58