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