blob: 9d71d0d714c9d32db1e3f188aff0b0f4a397a1f5 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
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 Deymobd04b142014-03-18 15:00:05 -070016
Gilad Arnold48415f12014-06-27 07:10:58 -070017#ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
18#define UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
Alex Deymobd04b142014-03-18 15:00:05 -070019
Ben Chan02f7c1d2014-10-18 15:18:02 -070020#include <memory>
Alex Deymobd04b142014-03-18 15:00:05 -070021#include <string>
22
Alex Deymo39910dc2015-11-09 17:04:30 -080023#include "update_engine/common/boot_control_interface.h"
24#include "update_engine/common/hardware_interface.h"
Alex Deymo63784a52014-05-28 10:46:14 -070025#include "update_engine/update_manager/system_provider.h"
Alex Deymobd04b142014-03-18 15:00:05 -070026
Daniel Erat941cf232017-04-20 12:09:58 -060027namespace org {
28namespace chromium {
Daniel Erat04df23a2018-03-29 17:55:35 -070029class KioskAppServiceInterfaceProxyInterface;
Daniel Erat941cf232017-04-20 12:09:58 -060030} // namespace chromium
31} // namespace org
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080032
Alex Deymo63784a52014-05-28 10:46:14 -070033namespace chromeos_update_manager {
Alex Deymobd04b142014-03-18 15:00:05 -070034
35// SystemProvider concrete implementation.
36class RealSystemProvider : public SystemProvider {
37 public:
Daniel Erat941cf232017-04-20 12:09:58 -060038 RealSystemProvider(
39 chromeos_update_engine::HardwareInterface* hardware,
40 chromeos_update_engine::BootControlInterface* boot_control,
Daniel Erat04df23a2018-03-29 17:55:35 -070041 org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy)
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080042 : hardware_(hardware),
Amin Hassani47186292017-08-01 15:03:08 -070043#if USE_CHROME_KIOSK_APP
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080044 boot_control_(boot_control),
Daniel Erat04df23a2018-03-29 17:55:35 -070045 kiosk_app_proxy_(kiosk_app_proxy) {
46 }
Amin Hassani47186292017-08-01 15:03:08 -070047#else
48 boot_control_(boot_control) {}
49#endif // USE_CHROME_KIOSK_APP
Alex Deymobd04b142014-03-18 15:00:05 -070050
Alex Deymo42c30c32014-04-24 18:41:18 -070051 // Initializes the provider and returns whether it succeeded.
52 bool Init();
53
Alex Vakulenko157fe302014-08-11 15:59:58 -070054 Variable<bool>* var_is_normal_boot_mode() override {
David Zeuthen21716e22014-04-23 15:42:05 -070055 return var_is_normal_boot_mode_.get();
56 }
57
Alex Vakulenko157fe302014-08-11 15:59:58 -070058 Variable<bool>* var_is_official_build() override {
David Zeuthen21716e22014-04-23 15:42:05 -070059 return var_is_official_build_.get();
60 }
61
Alex Vakulenko157fe302014-08-11 15:59:58 -070062 Variable<bool>* var_is_oobe_complete() override {
Gilad Arnold48e13612014-05-16 10:18:05 -070063 return var_is_oobe_complete_.get();
64 }
65
Alex Deymo763e7db2015-08-27 21:08:08 -070066 Variable<unsigned int>* var_num_slots() override {
67 return var_num_slots_.get();
Gilad Arnoldbfc44f72014-07-09 14:41:39 -070068 }
69
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080070 Variable<std::string>* var_kiosk_required_platform_version() override {
71 return var_kiosk_required_platform_version_.get();
72 }
73
Alex Deymobd04b142014-03-18 15:00:05 -070074 private:
Xiyuan Xiaed9bd922016-04-07 14:45:16 -070075 bool GetKioskAppRequiredPlatformVersion(
76 std::string* required_platform_version);
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080077
Ben Chan02f7c1d2014-10-18 15:18:02 -070078 std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_;
79 std::unique_ptr<Variable<bool>> var_is_official_build_;
80 std::unique_ptr<Variable<bool>> var_is_oobe_complete_;
Alex Deymo763e7db2015-08-27 21:08:08 -070081 std::unique_ptr<Variable<unsigned int>> var_num_slots_;
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080082 std::unique_ptr<Variable<std::string>> var_kiosk_required_platform_version_;
Gilad Arnold48e13612014-05-16 10:18:05 -070083
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080084 chromeos_update_engine::HardwareInterface* const hardware_;
85 chromeos_update_engine::BootControlInterface* const boot_control_;
Amin Hassani47186292017-08-01 15:03:08 -070086#if USE_CHROME_KIOSK_APP
Daniel Erat04df23a2018-03-29 17:55:35 -070087 org::chromium::KioskAppServiceInterfaceProxyInterface* const kiosk_app_proxy_;
Amin Hassani47186292017-08-01 15:03:08 -070088#endif // USE_CHROME_KIOSK_APP
David Zeuthen21716e22014-04-23 15:42:05 -070089
Alex Deymobd04b142014-03-18 15:00:05 -070090 DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
91};
92
Alex Deymo63784a52014-05-28 10:46:14 -070093} // namespace chromeos_update_manager
Alex Deymobd04b142014-03-18 15:00:05 -070094
Gilad Arnold48415f12014-06-27 07:10:58 -070095#endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_