1 /*
2 * Copyright (C) 2022 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 "accessibility_extension.h"
17 #include "ability_local_record.h"
18 #include "hilog_wrapper.h"
19
20 namespace OHOS {
21 namespace Accessibility {
Init(const std::shared_ptr<AbilityRuntime::AbilityLocalRecord> & record,const std::shared_ptr<AbilityRuntime::OHOSApplication> & application,std::shared_ptr<AbilityRuntime::AbilityHandler> & handler,const sptr<IRemoteObject> & token)22 void AccessibilityExtension::Init(const std::shared_ptr<AbilityRuntime::AbilityLocalRecord> &record,
23 const std::shared_ptr<AbilityRuntime::OHOSApplication> &application,
24 std::shared_ptr<AbilityRuntime::AbilityHandler> &handler,
25 const sptr<IRemoteObject> &token)
26 {
27 ExtensionBase<AccessibilityExtensionContext>::Init(record, application, handler, token);
28 HILOG_INFO();
29 }
30
CreateAndInitContext(const std::shared_ptr<AbilityRuntime::AbilityLocalRecord> & record,const std::shared_ptr<AbilityRuntime::OHOSApplication> & application,std::shared_ptr<AbilityRuntime::AbilityHandler> & handler,const sptr<IRemoteObject> & token)31 std::shared_ptr<AccessibilityExtensionContext> AccessibilityExtension::CreateAndInitContext(
32 const std::shared_ptr<AbilityRuntime::AbilityLocalRecord> &record,
33 const std::shared_ptr<AbilityRuntime::OHOSApplication> &application,
34 std::shared_ptr<AbilityRuntime::AbilityHandler> &handler,
35 const sptr<IRemoteObject> &token)
36 {
37 std::shared_ptr<AccessibilityExtensionContext> context =
38 ExtensionBase<AccessibilityExtensionContext>::CreateAndInitContext(record, application, handler, token);
39 if (!record) {
40 HILOG_ERROR("AccessibilityExtension::CreateAndInitContext record is nullptr");
41 }
42 return context;
43 }
44 } // namespace Accessibility
45 } // namespace OHOS