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 "update_engine/common/boot_control_interface.h" 24 #include "update_engine/common/hardware_interface.h" 25 #include "update_engine/update_manager/system_provider.h" 26 27 namespace chromeos_update_engine { 28 class LibCrosProxy; 29 } 30 31 namespace chromeos_update_manager { 32 33 // SystemProvider concrete implementation. 34 class RealSystemProvider : public SystemProvider { 35 public: RealSystemProvider(chromeos_update_engine::HardwareInterface * hardware,chromeos_update_engine::BootControlInterface * boot_control,chromeos_update_engine::LibCrosProxy * libcros_proxy)36 RealSystemProvider(chromeos_update_engine::HardwareInterface* hardware, 37 chromeos_update_engine::BootControlInterface* boot_control, 38 chromeos_update_engine::LibCrosProxy* libcros_proxy) 39 : hardware_(hardware), 40 boot_control_(boot_control), 41 libcros_proxy_(libcros_proxy) {} 42 43 // Initializes the provider and returns whether it succeeded. 44 bool Init(); 45 var_is_normal_boot_mode()46 Variable<bool>* var_is_normal_boot_mode() override { 47 return var_is_normal_boot_mode_.get(); 48 } 49 var_is_official_build()50 Variable<bool>* var_is_official_build() override { 51 return var_is_official_build_.get(); 52 } 53 var_is_oobe_complete()54 Variable<bool>* var_is_oobe_complete() override { 55 return var_is_oobe_complete_.get(); 56 } 57 var_num_slots()58 Variable<unsigned int>* var_num_slots() override { 59 return var_num_slots_.get(); 60 } 61 var_kiosk_required_platform_version()62 Variable<std::string>* var_kiosk_required_platform_version() override { 63 return var_kiosk_required_platform_version_.get(); 64 } 65 66 private: 67 bool GetKioskAppRequiredPlatformVersion( 68 std::string* required_platform_version); 69 70 std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_; 71 std::unique_ptr<Variable<bool>> var_is_official_build_; 72 std::unique_ptr<Variable<bool>> var_is_oobe_complete_; 73 std::unique_ptr<Variable<unsigned int>> var_num_slots_; 74 std::unique_ptr<Variable<std::string>> var_kiosk_required_platform_version_; 75 76 chromeos_update_engine::HardwareInterface* const hardware_; 77 chromeos_update_engine::BootControlInterface* const boot_control_; 78 chromeos_update_engine::LibCrosProxy* const libcros_proxy_ ALLOW_UNUSED_TYPE; 79 80 DISALLOW_COPY_AND_ASSIGN(RealSystemProvider); 81 }; 82 83 } // namespace chromeos_update_manager 84 85 #endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_ 86