blob: 91fee7f73834a02a9b1f6834d3b8924da6e8b619 [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
Miriam Polzer8db52492020-09-17 14:06:46 +020023#include <base/version.h>
24
Amin Hassaniec7bc112020-10-29 16:47:58 -070025#include "update_engine/common/system_state.h"
Alex Deymo63784a52014-05-28 10:46:14 -070026#include "update_engine/update_manager/system_provider.h"
Alex Deymobd04b142014-03-18 15:00:05 -070027
Daniel Erat941cf232017-04-20 12:09:58 -060028namespace org {
29namespace chromium {
Daniel Erat04df23a2018-03-29 17:55:35 -070030class KioskAppServiceInterfaceProxyInterface;
Daniel Erat941cf232017-04-20 12:09:58 -060031} // namespace chromium
32} // namespace org
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080033
Alex Deymo63784a52014-05-28 10:46:14 -070034namespace chromeos_update_manager {
Alex Deymobd04b142014-03-18 15:00:05 -070035
36// SystemProvider concrete implementation.
37class RealSystemProvider : public SystemProvider {
38 public:
Daniel Erat941cf232017-04-20 12:09:58 -060039 RealSystemProvider(
Miriam Polzer8db52492020-09-17 14:06:46 +020040 chromeos_update_engine::SystemState* system_state,
Daniel Erat04df23a2018-03-29 17:55:35 -070041 org::chromium::KioskAppServiceInterfaceProxyInterface* kiosk_app_proxy)
Miriam Polzer8db52492020-09-17 14:06:46 +020042 : system_state_(system_state), kiosk_app_proxy_(kiosk_app_proxy) {
Daniel Erat04df23a2018-03-29 17:55:35 -070043 }
Alex Deymobd04b142014-03-18 15:00:05 -070044
Alex Deymo42c30c32014-04-24 18:41:18 -070045 // Initializes the provider and returns whether it succeeded.
46 bool Init();
47
Alex Vakulenko157fe302014-08-11 15:59:58 -070048 Variable<bool>* var_is_normal_boot_mode() override {
David Zeuthen21716e22014-04-23 15:42:05 -070049 return var_is_normal_boot_mode_.get();
50 }
51
Alex Vakulenko157fe302014-08-11 15:59:58 -070052 Variable<bool>* var_is_official_build() override {
David Zeuthen21716e22014-04-23 15:42:05 -070053 return var_is_official_build_.get();
54 }
55
Alex Vakulenko157fe302014-08-11 15:59:58 -070056 Variable<bool>* var_is_oobe_complete() override {
Gilad Arnold48e13612014-05-16 10:18:05 -070057 return var_is_oobe_complete_.get();
58 }
59
Alex Deymo763e7db2015-08-27 21:08:08 -070060 Variable<unsigned int>* var_num_slots() override {
61 return var_num_slots_.get();
Gilad Arnoldbfc44f72014-07-09 14:41:39 -070062 }
63
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080064 Variable<std::string>* var_kiosk_required_platform_version() override {
65 return var_kiosk_required_platform_version_.get();
66 }
67
Miriam Polzer8db52492020-09-17 14:06:46 +020068 Variable<base::Version>* var_chromeos_version() override {
69 return var_chromeos_version_.get();
70 }
71
Alex Deymobd04b142014-03-18 15:00:05 -070072 private:
Xiyuan Xiaed9bd922016-04-07 14:45:16 -070073 bool GetKioskAppRequiredPlatformVersion(
74 std::string* required_platform_version);
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080075
Ben Chan02f7c1d2014-10-18 15:18:02 -070076 std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_;
77 std::unique_ptr<Variable<bool>> var_is_official_build_;
78 std::unique_ptr<Variable<bool>> var_is_oobe_complete_;
Alex Deymo763e7db2015-08-27 21:08:08 -070079 std::unique_ptr<Variable<unsigned int>> var_num_slots_;
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080080 std::unique_ptr<Variable<std::string>> var_kiosk_required_platform_version_;
Miriam Polzer8db52492020-09-17 14:06:46 +020081 std::unique_ptr<Variable<base::Version>> var_chromeos_version_;
Gilad Arnold48e13612014-05-16 10:18:05 -070082
Miriam Polzer8db52492020-09-17 14:06:46 +020083 chromeos_update_engine::SystemState* const system_state_;
Amin Hassani64a80162020-11-09 16:58:17 -080084
Daniel Erat04df23a2018-03-29 17:55:35 -070085 org::chromium::KioskAppServiceInterfaceProxyInterface* const kiosk_app_proxy_;
David Zeuthen21716e22014-04-23 15:42:05 -070086
Alex Deymobd04b142014-03-18 15:00:05 -070087 DISALLOW_COPY_AND_ASSIGN(RealSystemProvider);
88};
89
Alex Deymo63784a52014-05-28 10:46:14 -070090} // namespace chromeos_update_manager
Alex Deymobd04b142014-03-18 15:00:05 -070091
Gilad Arnold48415f12014-06-27 07:10:58 -070092#endif // UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_