blob: 75f1fb8502559184063810cb43f36a27c0b718d6 [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
10#include <base/memory/scoped_ptr.h>
11#include <base/time/time.h>
12
13#include "update_engine/policy_manager/provider.h"
14#include "update_engine/policy_manager/variable.h"
15
16namespace chromeos_policy_manager {
17
18enum class Stage {
19 kIdle,
20 kCheckingForUpdate,
21 kUpdateAvailable,
22 kDownloading,
23 kVerifying,
24 kFinalizing,
25 kUpdatedNeedReboot,
26 kReportingErrorEvent,
27 kAttemptingRollback,
28};
29
30// Provider for Chrome OS update related information.
31class UpdaterProvider : public Provider {
32 public:
David Zeuthen21716e22014-04-23 15:42:05 -070033 virtual ~UpdaterProvider() {}
34
Gilad Arnoldae47a9a2014-03-26 12:16:47 -070035 // A variable returning the last update check time.
36 virtual Variable<base::Time>* var_last_checked_time() = 0;
37
38 // A variable reporting the time when an update was last completed in the
39 // current boot cycle. Returns an error if an update completed time could not
40 // be read (e.g. no update was completed in the current boot cycle) or is
41 // invalid.
42 //
43 // IMPORTANT: The time reported is not the wallclock time reading at the time
44 // of the update, rather it is the point in time when the update completed
45 // relative to the current wallclock time reading. Therefore, the gap between
46 // the reported value and the current wallclock time is guaranteed to be
47 // monotonically increasing.
48 virtual Variable<base::Time>* var_update_completed_time() = 0;
49
50 // A variable returning the update progress (0.0 to 1.0).
51 virtual Variable<double>* var_progress() = 0;
52
53 // A variable returning the current update status.
54 virtual Variable<Stage>* var_stage() = 0;
55
56 // A variable returning the update target version.
57 virtual Variable<std::string>* var_new_version() = 0;
58
59 // A variable returning the update payload size.
60 virtual Variable<size_t>* var_payload_size() = 0;
61
62 // A variable returning the current channel.
63 virtual Variable<std::string>* var_curr_channel() = 0;
64
65 // A variable returning the update target channel.
66 virtual Variable<std::string>* var_new_channel() = 0;
67
68 // A variable indicating whether P2P updates are allowed.
69 virtual Variable<bool>* var_p2p_enabled() = 0;
70
71 // A variable indicating whether updates are allowed over a cellular network.
72 virtual Variable<bool>* var_cellular_enabled() = 0;
David Zeuthen21716e22014-04-23 15:42:05 -070073
74 protected:
75 UpdaterProvider() {}
76
77 private:
78 DISALLOW_COPY_AND_ASSIGN(UpdaterProvider);
Gilad Arnoldae47a9a2014-03-26 12:16:47 -070079};
80
81} // namespace chromeos_policy_manager
82
83#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_