• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_NATIVE_INCLUDE_DOMAIN_ACCOUNT_PROXY_H
17 #define OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_NATIVE_INCLUDE_DOMAIN_ACCOUNT_PROXY_H
18 
19 #include <string>
20 #include "account_error_no.h"
21 #include "idomain_account.h"
22 #include "iremote_proxy.h"
23 
24 namespace OHOS {
25 namespace AccountSA {
26 class DomainAccountProxy : public IRemoteProxy<IDomainAccount> {
27 public:
28     explicit DomainAccountProxy(const sptr<IRemoteObject> &object);
29     ~DomainAccountProxy() override;
30     ErrCode RegisterPlugin(const sptr<IDomainAccountPlugin> &plugin) override;
31     ErrCode UnregisterPlugin() override;
32     ErrCode GetAccountStatus(
33         const DomainAccountInfo &info, DomainAccountStatus &status) override;
34     ErrCode RegisterAccountStatusListener(
35         const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &listener) override;
36     ErrCode RegisterAccountStatusListener(const sptr<IDomainAccountCallback> &listener) override;
37     ErrCode UnregisterAccountStatusListener(
38         const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &listener) override;
39     ErrCode UnregisterAccountStatusListener(const sptr<IDomainAccountCallback> &listener) override;
40     ErrCode Auth(const DomainAccountInfo &info, const std::vector<uint8_t> &password,
41         const sptr<IDomainAuthCallback> &callback) override;
42     ErrCode AuthUser(int32_t userId, const std::vector<uint8_t> &password,
43         const sptr<IDomainAuthCallback> &callback) override;
44     ErrCode AuthWithPopup(int32_t userId, const sptr<IDomainAuthCallback> &callback) override;
45     ErrCode HasDomainAccount(const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &callback) override;
46     ErrCode UpdateAccountToken(const DomainAccountInfo &info, const std::vector<uint8_t> &token) override;
47     ErrCode GetAccessToken(const DomainAccountInfo &info, const AAFwk::WantParams &parameters,
48         const sptr<IDomainAccountCallback> &callback) override;
49     ErrCode GetDomainAccountInfo(const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &callback) override;
50 
51 private:
52     ErrCode SendRequest(DomainAccountInterfaceCode code, MessageParcel &data, MessageParcel &reply);
53 
54 private:
55     static inline BrokerDelegator<DomainAccountProxy> delegator_;
56 };
57 }  // namespace AccountSA
58 }  // namespace OHOS
59 #endif  // OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_NATIVE_INCLUDE_DOMAIN_ACCOUNT_PROXY_H