| Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 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 | // | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 16 |  | 
| Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_ | 
 | 18 | #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_ | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 19 |  | 
| Ben Chan | 02f7c1d | 2014-10-18 15:18:02 -0700 | [diff] [blame] | 20 | #include <memory> | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 21 | #include <string> | 
 | 22 |  | 
| Alex Deymo | 39910dc | 2015-11-09 17:04:30 -0800 | [diff] [blame] | 23 | #include "update_engine/common/boot_control_interface.h" | 
 | 24 | #include "update_engine/common/hardware_interface.h" | 
| Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 25 | #include "update_engine/update_manager/system_provider.h" | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 26 |  | 
| Daniel Erat | 941cf23 | 2017-04-20 12:09:58 -0600 | [diff] [blame] | 27 | namespace org { | 
 | 28 | namespace chromium { | 
| Daniel Erat | 04df23a | 2018-03-29 17:55:35 -0700 | [diff] [blame] | 29 | class KioskAppServiceInterfaceProxyInterface; | 
| Daniel Erat | 941cf23 | 2017-04-20 12:09:58 -0600 | [diff] [blame] | 30 | }  // namespace chromium | 
 | 31 | }  // namespace org | 
| Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 32 |  | 
| Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 33 | namespace chromeos_update_manager { | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 34 |  | 
 | 35 | // SystemProvider concrete implementation. | 
 | 36 | class RealSystemProvider : public SystemProvider { | 
 | 37 |  public: | 
| Daniel Erat | 941cf23 | 2017-04-20 12:09:58 -0600 | [diff] [blame] | 38 |   RealSystemProvider( | 
 | 39 |       chromeos_update_engine::HardwareInterface* hardware, | 
 | 40 |       chromeos_update_engine::BootControlInterface* boot_control, | 
| Daniel Erat | 04df23a | 2018-03-29 17:55:35 -0700 | [diff] [blame] | 41 |       org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy) | 
| Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 42 |       : hardware_(hardware), | 
| Amin Hassani | 4718629 | 2017-08-01 15:03:08 -0700 | [diff] [blame] | 43 | #if USE_CHROME_KIOSK_APP | 
| Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 44 |         boot_control_(boot_control), | 
| Daniel Erat | 04df23a | 2018-03-29 17:55:35 -0700 | [diff] [blame] | 45 |         kiosk_app_proxy_(kiosk_app_proxy) { | 
 | 46 |   } | 
| Amin Hassani | 4718629 | 2017-08-01 15:03:08 -0700 | [diff] [blame] | 47 | #else | 
| Amin Hassani | 4b71743 | 2019-01-14 16:24:20 -0800 | [diff] [blame] | 48 |         boot_control_(boot_control) { | 
 | 49 |   } | 
| Amin Hassani | 4718629 | 2017-08-01 15:03:08 -0700 | [diff] [blame] | 50 | #endif  // USE_CHROME_KIOSK_APP | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 51 |  | 
| Alex Deymo | 42c30c3 | 2014-04-24 18:41:18 -0700 | [diff] [blame] | 52 |   // Initializes the provider and returns whether it succeeded. | 
 | 53 |   bool Init(); | 
 | 54 |  | 
| Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame] | 55 |   Variable<bool>* var_is_normal_boot_mode() override { | 
| David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame] | 56 |     return var_is_normal_boot_mode_.get(); | 
 | 57 |   } | 
 | 58 |  | 
| Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame] | 59 |   Variable<bool>* var_is_official_build() override { | 
| David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame] | 60 |     return var_is_official_build_.get(); | 
 | 61 |   } | 
 | 62 |  | 
| Alex Vakulenko | 157fe30 | 2014-08-11 15:59:58 -0700 | [diff] [blame] | 63 |   Variable<bool>* var_is_oobe_complete() override { | 
| Gilad Arnold | 48e1361 | 2014-05-16 10:18:05 -0700 | [diff] [blame] | 64 |     return var_is_oobe_complete_.get(); | 
 | 65 |   } | 
 | 66 |  | 
| Alex Deymo | 763e7db | 2015-08-27 21:08:08 -0700 | [diff] [blame] | 67 |   Variable<unsigned int>* var_num_slots() override { | 
 | 68 |     return var_num_slots_.get(); | 
| Gilad Arnold | bfc44f7 | 2014-07-09 14:41:39 -0700 | [diff] [blame] | 69 |   } | 
 | 70 |  | 
| Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 71 |   Variable<std::string>* var_kiosk_required_platform_version() override { | 
 | 72 |     return var_kiosk_required_platform_version_.get(); | 
 | 73 |   } | 
 | 74 |  | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 75 |  private: | 
| Xiyuan Xia | ed9bd92 | 2016-04-07 14:45:16 -0700 | [diff] [blame] | 76 |   bool GetKioskAppRequiredPlatformVersion( | 
 | 77 |       std::string* required_platform_version); | 
| Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 78 |  | 
| Ben Chan | 02f7c1d | 2014-10-18 15:18:02 -0700 | [diff] [blame] | 79 |   std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_; | 
 | 80 |   std::unique_ptr<Variable<bool>> var_is_official_build_; | 
 | 81 |   std::unique_ptr<Variable<bool>> var_is_oobe_complete_; | 
| Alex Deymo | 763e7db | 2015-08-27 21:08:08 -0700 | [diff] [blame] | 82 |   std::unique_ptr<Variable<unsigned int>> var_num_slots_; | 
| Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 83 |   std::unique_ptr<Variable<std::string>> var_kiosk_required_platform_version_; | 
| Gilad Arnold | 48e1361 | 2014-05-16 10:18:05 -0700 | [diff] [blame] | 84 |  | 
| Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 85 |   chromeos_update_engine::HardwareInterface* const hardware_; | 
 | 86 |   chromeos_update_engine::BootControlInterface* const boot_control_; | 
| Amin Hassani | 4718629 | 2017-08-01 15:03:08 -0700 | [diff] [blame] | 87 | #if USE_CHROME_KIOSK_APP | 
| Daniel Erat | 04df23a | 2018-03-29 17:55:35 -0700 | [diff] [blame] | 88 |   org::chromium::KioskAppServiceInterfaceProxyInterface* const kiosk_app_proxy_; | 
| Amin Hassani | 4718629 | 2017-08-01 15:03:08 -0700 | [diff] [blame] | 89 | #endif  // USE_CHROME_KIOSK_APP | 
| David Zeuthen | 21716e2 | 2014-04-23 15:42:05 -0700 | [diff] [blame] | 90 |  | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 91 |   DISALLOW_COPY_AND_ASSIGN(RealSystemProvider); | 
 | 92 | }; | 
 | 93 |  | 
| Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 94 | }  // namespace chromeos_update_manager | 
| Alex Deymo | bd04b14 | 2014-03-18 15:00:05 -0700 | [diff] [blame] | 95 |  | 
| Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 96 | #endif  // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_ |