1 /* 2 * Copyright (c) 2023-2025 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 #include "domain_account_callback_service.h" 17 #include "account_log_wrapper.h" 18 19 namespace OHOS { 20 namespace AccountSA { DomainAccountCallbackService(const std::shared_ptr<DomainAccountCallback> & callback)21DomainAccountCallbackService::DomainAccountCallbackService( 22 const std::shared_ptr<DomainAccountCallback> &callback) 23 : innerCallback_(callback) 24 {} 25 DomainAccountCallbackService(const DomainAccountCallbackFunc & callback)26DomainAccountCallbackService::DomainAccountCallbackService(const DomainAccountCallbackFunc &callback) 27 : callback_(callback) 28 {} 29 ~DomainAccountCallbackService()30DomainAccountCallbackService::~DomainAccountCallbackService() 31 {} 32 OnResult(int32_t errCode,const DomainAccountParcel & domainAccountParcel)33ErrCode DomainAccountCallbackService::OnResult(int32_t errCode, const DomainAccountParcel &domainAccountParcel) 34 { 35 ACCOUNT_LOGI("enter"); 36 Parcel parcel; 37 domainAccountParcel.GetParcelData(parcel); 38 if (innerCallback_ != nullptr) { 39 innerCallback_->OnResult(errCode, parcel); 40 } 41 if (callback_ != nullptr) { 42 callback_(errCode, parcel); 43 } 44 return ERR_OK; 45 } 46 } // namespace AccountSA 47 } // namespace OHOS