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 #ifndef LOGO_STRATEGY_H 17 #define LOGO_STRATEGY_H 18 19 #include <memory> 20 #include "page/page_manager.h" 21 #include "updater_ui.h" 22 23 namespace Updater { 24 class LogoStrategy { 25 public: LogoStrategy(const ComInfo & id)26 explicit LogoStrategy(const ComInfo &id) : id_ {id}, pgMgr_ {PageManager::GetInstance()} {} 27 virtual ~LogoStrategy() = default; 28 virtual void Show() const = 0; 29 virtual void Hide() const = 0; 30 static std::unique_ptr<LogoStrategy> Factory(const std::string &type, const ComInfo &id); 31 protected: 32 ComInfo id_; 33 PageManager &pgMgr_; 34 }; 35 36 class AnimatorLogo final : public LogoStrategy { 37 public: AnimatorLogo(const ComInfo & id)38 explicit AnimatorLogo(const ComInfo &id) : LogoStrategy(id) { } 39 ~AnimatorLogo() override = default; 40 void Show() const override; 41 void Hide() const override; 42 }; 43 44 class ImageLogo final : public LogoStrategy { 45 public: ImageLogo(const ComInfo & id)46 explicit ImageLogo(const ComInfo &id) : LogoStrategy(id) { } 47 ~ImageLogo() override = default; 48 void Show() const override; 49 void Hide() const override; 50 }; 51 } // namespace Updater 52 #endif 53