blob: 85074f6b64566210ce7a2c234c3b697575fdb485 [file] [log] [blame]
Gilad Arnoldae47a9a2014-03-26 12:16:47 -07001// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_
7
8#include <string>
9
Gilad Arnoldae47a9a2014-03-26 12:16:47 -070010#include <base/time/time.h>
11
12#include "update_engine/policy_manager/provider.h"
13#include "update_engine/policy_manager/variable.h"
14
15namespace chromeos_policy_manager {
16
17enum class Stage {
18 kIdle,
19 kCheckingForUpdate,
20 kUpdateAvailable,
21 kDownloading,
22 kVerifying,
23 kFinalizing,
24 kUpdatedNeedReboot,
25 kReportingErrorEvent,
26 kAttemptingRollback,
27};
28
29// Provider for Chrome OS update related information.
30class UpdaterProvider : public Provider {
31 public:
David Zeuthen21716e22014-04-23 15:42:05 -070032 virtual ~UpdaterProvider() {}
33
Gilad Arnoldae47a9a2014-03-26 12:16:47 -070034 // A variable returning the last update check time.
35 virtual Variable<base::Time>* var_last_checked_time() = 0;
36
37 // A variable reporting the time when an update was last completed in the
38 // current boot cycle. Returns an error if an update completed time could not
39 // be read (e.g. no update was completed in the current boot cycle) or is
40 // invalid.
41 //
42 // IMPORTANT: The time reported is not the wallclock time reading at the time
43 // of the update, rather it is the point in time when the update completed
44 // relative to the current wallclock time reading. Therefore, the gap between
45 // the reported value and the current wallclock time is guaranteed to be
46 // monotonically increasing.
47 virtual Variable<base::Time>* var_update_completed_time() = 0;
48
49 // A variable returning the update progress (0.0 to 1.0).
50 virtual Variable<double>* var_progress() = 0;
51
52 // A variable returning the current update status.
53 virtual Variable<Stage>* var_stage() = 0;
54
55 // A variable returning the update target version.
56 virtual Variable<std::string>* var_new_version() = 0;
57
58 // A variable returning the update payload size.
59 virtual Variable<size_t>* var_payload_size() = 0;
60
61 // A variable returning the current channel.
62 virtual Variable<std::string>* var_curr_channel() = 0;
63
64 // A variable returning the update target channel.
65 virtual Variable<std::string>* var_new_channel() = 0;
66
67 // A variable indicating whether P2P updates are allowed.
68 virtual Variable<bool>* var_p2p_enabled() = 0;
69
70 // A variable indicating whether updates are allowed over a cellular network.
71 virtual Variable<bool>* var_cellular_enabled() = 0;
David Zeuthen21716e22014-04-23 15:42:05 -070072
73 protected:
74 UpdaterProvider() {}
75
76 private:
77 DISALLOW_COPY_AND_ASSIGN(UpdaterProvider);
Gilad Arnoldae47a9a2014-03-26 12:16:47 -070078};
79
80} // namespace chromeos_policy_manager
81
82#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_