1 /* 2 * Copyright (c) 2021 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 FOUNDATION_ABILITYRUNTIME_OHOS_WALLPAPER_EXTENSION_ABILITY_H 17 #define FOUNDATION_ABILITYRUNTIME_OHOS_WALLPAPER_EXTENSION_ABILITY_H 18 19 #include "extension_base.h" 20 #include "visibility.h" 21 22 namespace OHOS { 23 namespace AbilityRuntime { 24 class WallpaperExtensionContext; 25 class Runtime; 26 /** 27 * @brief Basic wallpaper components. 28 */ 29 class WallpaperExtensionAbility : public ExtensionBase<WallpaperExtensionContext>, 30 public std::enable_shared_from_this<WallpaperExtensionAbility> { 31 public: 32 WallpaperExtensionAbility() = default; 33 virtual ~WallpaperExtensionAbility() = default; 34 35 /** 36 * @brief Create and init context. 37 * 38 * @param record the extension record. 39 * @param application the application info. 40 * @param handler the extension handler. 41 * @param token the remote token. 42 * @return The created context. 43 */ 44 virtual std::shared_ptr<WallpaperExtensionContext> CreateAndInitContext( 45 const std::shared_ptr<AbilityLocalRecord> &record, const std::shared_ptr<OHOSApplication> &application, 46 std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token) override; 47 48 /** 49 * @brief Init the extension. 50 * 51 * @param record the extension record. 52 * @param application the application info. 53 * @param handler the extension handler. 54 * @param token the remote token. 55 */ 56 virtual void Init(const std::shared_ptr<AbilityLocalRecord> &record, 57 const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler, 58 const sptr<IRemoteObject> &token) override; 59 60 /** 61 * @brief Create Extension. 62 * 63 * @param runtime The runtime. 64 * @return The WallpaperExtensionAbility instance. 65 */ 66 WALLPAPER_API static WallpaperExtensionAbility *Create(const std::unique_ptr<Runtime> &runtime); 67 }; 68 } // namespace AbilityRuntime 69 } // namespace OHOS 70 #endif // FOUNDATION_ABILITYRUNTIME_OHOS_WALLPAPER_EXTENSION_ABILITY_H