1 /*
2  * Copyright (c) 2022-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 /**
17  * @addtogroup TokenCallback
18  * @{
19  *
20  * @brief Provides napi RequestPermissionsFromUser callback interface
21  *
22  * @since 8.0
23  * @version 8.0
24  */
25 
26 /**
27  * @file i_token_callback.h
28  *
29  * @brief Declares ITokenCallback interface interfaces.
30  *
31  * @since 8.0
32  * @version 8.0
33  */
34 
35 #ifndef I_TOKEN_CALLBACK_H
36 #define I_TOKEN_CALLBACK_H
37 
38 #include <iremote_broker.h>
39 #include "accesstoken_grant_result_ipc_interface_code.h"
40 
41 namespace OHOS {
42 namespace Security {
43 namespace AccessToken {
44 /**
45  * @brief Declares ITokenCallback interface class
46  */
47 class ITokenCallback : public IRemoteBroker {
48 public:
49     /**
50      * @brief declare interface descritor which used in parcel.
51      * @param const string
52      */
53     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.security.accesstoken.tokencallback");
54 
55     /**
56      * @brief pure virtual fuction.
57      * @param permissions permission name list
58      * @param grantResults permission grant result
59      */
60     virtual void GrantResultsCallback(
61         const std::vector<std::string> &permissions, const std::vector<int> &grantResults) = 0;
62 
63     /**
64      * @brief pure virtual fuction.
65      */
WindowShownCallback()66     virtual void WindowShownCallback() {};
67 
68     /** interface enum */
69     enum InterfaceCode {
70         GRANT_RESULT_CALLBACK = 0,
71         WINDOW_DESTORY_CALLBACK,
72     };
73 };
74 } // namespace AccessToken
75 } // namespace Security
76 } // namespace OHOS
77 #endif  // I_TOKEN_CALLBACK_H