1 // 2 // Copyright (C) 2014 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_ 18 #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_ 19 20 #include <memory> 21 #include <string> 22 23 #include <base/version.h> 24 25 #include "update_engine/update_manager/system_provider.h" 26 27 namespace org { 28 namespace chromium { 29 class KioskAppServiceInterfaceProxyInterface; 30 } // namespace chromium 31 } // namespace org 32 33 namespace chromeos_update_manager { 34 35 // SystemProvider concrete implementation. 36 class RealSystemProvider : public SystemProvider { 37 public: RealSystemProvider(org::chromium::KioskAppServiceInterfaceProxyInterface * kiosk_app_proxy)38 RealSystemProvider( 39 org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy) 40 : kiosk_app_proxy_(kiosk_app_proxy) {} 41 42 // Initializes the provider and returns whether it succeeded. 43 bool Init(); 44 var_is_normal_boot_mode()45 Variable<bool>* var_is_normal_boot_mode() override { 46 return var_is_normal_boot_mode_.get(); 47 } 48 var_is_official_build()49 Variable<bool>* var_is_official_build() override { 50 return var_is_official_build_.get(); 51 } 52 var_is_oobe_complete()53 Variable<bool>* var_is_oobe_complete() override { 54 return var_is_oobe_complete_.get(); 55 } 56 var_num_slots()57 Variable<unsigned int>* var_num_slots() override { 58 return var_num_slots_.get(); 59 } 60 var_kiosk_required_platform_version()61 Variable<std::string>* var_kiosk_required_platform_version() override { 62 return var_kiosk_required_platform_version_.get(); 63 } 64 var_chromeos_version()65 Variable<base::Version>* var_chromeos_version() override { 66 return var_chromeos_version_.get(); 67 } 68 69 private: 70 bool GetKioskAppRequiredPlatformVersion( 71 std::string* required_platform_version); 72 73 std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_; 74 std::unique_ptr<Variable<bool>> var_is_official_build_; 75 std::unique_ptr<Variable<bool>> var_is_oobe_complete_; 76 std::unique_ptr<Variable<unsigned int>> var_num_slots_; 77 std::unique_ptr<Variable<std::string>> var_kiosk_required_platform_version_; 78 std::unique_ptr<Variable<base::Version>> var_chromeos_version_; 79 80 org::chromium::KioskAppServiceInterfaceProxyInterface* const kiosk_app_proxy_; 81 82 DISALLOW_COPY_AND_ASSIGN(RealSystemProvider); 83 }; 84 85 } // namespace chromeos_update_manager 86 87 #endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_ 88