blob: f089a293f417739606a616b3e3a77e0b0902400a [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
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080027namespace chromeos_update_engine {
28class LibCrosProxy;
29}
30
Alex Deymo63784a52014-05-28 10:46:14 -070031namespace chromeos_update_manager {
Alex Deymobd04b142014-03-18 15:00:05 -070032
33// SystemProvider concrete implementation.
34class RealSystemProvider : public SystemProvider {
35 public:
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080036 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) {}
Alex Deymobd04b142014-03-18 15:00:05 -070042
Alex Deymo42c30c32014-04-24 18:41:18 -070043 // Initializes the provider and returns whether it succeeded.
44 bool Init();
45
Alex Vakulenko157fe302014-08-11 15:59:58 -070046 Variable<bool>* var_is_normal_boot_mode() override {
David Zeuthen21716e22014-04-23 15:42:05 -070047 return var_is_normal_boot_mode_.get();
48 }
49
Alex Vakulenko157fe302014-08-11 15:59:58 -070050 Variable<bool>* var_is_official_build() override {
David Zeuthen21716e22014-04-23 15:42:05 -070051 return var_is_official_build_.get();
52 }
53
Alex Vakulenko157fe302014-08-11 15:59:58 -070054 Variable<bool>* var_is_oobe_complete() override {
Gilad Arnold48e13612014-05-16 10:18:05 -070055 return var_is_oobe_complete_.get();
56 }
57
Alex Deymo763e7db2015-08-27 21:08:08 -070058 Variable<unsigned int>* var_num_slots() override {
59 return var_num_slots_.get();
Gilad Arnoldbfc44f72014-07-09 14:41:39 -070060 }
61
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080062 Variable<std::string>* var_kiosk_required_platform_version() override {
63 return var_kiosk_required_platform_version_.get();
64 }
65
Alex Deymobd04b142014-03-18 15:00:05 -070066 private:
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080067 std::string GetKioskAppRequiredPlatformVersion();
68
Ben Chan02f7c1d2014-10-18 15:18:02 -070069 std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_;
70 std::unique_ptr<Variable<bool>> var_is_official_build_;
71 std::unique_ptr<Variable<bool>> var_is_oobe_complete_;
Alex Deymo763e7db2015-08-27 21:08:08 -070072 std::unique_ptr<Variable<unsigned int>> var_num_slots_;
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080073 std::unique_ptr<Variable<std::string>> var_kiosk_required_platform_version_;
Gilad Arnold48e13612014-05-16 10:18:05 -070074
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080075 chromeos_update_engine::HardwareInterface* const hardware_;
76 chromeos_update_engine::BootControlInterface* const boot_control_;
77 chromeos_update_engine::LibCrosProxy* const libcros_proxy_;
David Zeuthen21716e22014-04-23 15:42:05 -070078
Alex Deymobd04b142014-03-18 15:00:05 -070079 DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
80};
81
Alex Deymo63784a52014-05-28 10:46:14 -070082} // namespace chromeos_update_manager
Alex Deymobd04b142014-03-18 15:00:05 -070083
Gilad Arnold48415f12014-06-27 07:10:58 -070084#endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_