1 /*
2 * Copyright (c) 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 #include "extension_record.h"
17 #include "ability_util.h"
18 #include "errors.h"
19
20 namespace OHOS {
21 namespace AbilityRuntime {
ExtensionRecord(const std::shared_ptr<AAFwk::AbilityRecord> & abilityRecord,const std::string & hostBundleName,int32_t extensionRecordId)22 ExtensionRecord::ExtensionRecord(const std::shared_ptr<AAFwk::AbilityRecord> &abilityRecord,
23 const std::string &hostBundleName, int32_t extensionRecordId)
24 : abilityRecord_(abilityRecord), hostBundleName_(hostBundleName), extensionRecordId_(extensionRecordId)
25 {}
26
27 ExtensionRecord::~ExtensionRecord() = default;
28
GetCallToken() const29 sptr<IRemoteObject> ExtensionRecord::GetCallToken() const
30 {
31 CHECK_POINTER_AND_RETURN(abilityRecord_, nullptr);
32 auto sessionInfo = abilityRecord_->GetSessionInfo();
33 CHECK_POINTER_AND_RETURN(sessionInfo, nullptr);
34 return sessionInfo->callerToken;
35 }
36
GetRootCallerToken() const37 sptr<IRemoteObject> ExtensionRecord::GetRootCallerToken() const
38 {
39 return rootCallerToken_;
40 }
41
SetRootCallerToken(sptr<IRemoteObject> & rootCallerToken)42 void ExtensionRecord::SetRootCallerToken(sptr<IRemoteObject> &rootCallerToken)
43 {
44 rootCallerToken_ = rootCallerToken;
45 }
46
ContinueToGetCallerToken()47 bool ExtensionRecord::ContinueToGetCallerToken()
48 {
49 return false;
50 }
51
Update(const AAFwk::AbilityRequest & abilityRequest)52 void ExtensionRecord::Update(const AAFwk::AbilityRequest &abilityRequest)
53 {
54 }
55 } // namespace AbilityRuntime
56 } // namespace OHOS
57