Gilad Arnold | ae47a9a | 2014-03-26 12:16:47 -0700 | [diff] [blame^] | 1 | // 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 | |
| 16 | namespace chromeos_policy_manager { |
| 17 | |
| 18 | enum 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. |
| 31 | class UpdaterProvider : public Provider { |
| 32 | public: |
| 33 | // A variable returning the last update check time. |
| 34 | virtual Variable<base::Time>* var_last_checked_time() = 0; |
| 35 | |
| 36 | // A variable reporting the time when an update was last completed in the |
| 37 | // current boot cycle. Returns an error if an update completed time could not |
| 38 | // be read (e.g. no update was completed in the current boot cycle) or is |
| 39 | // invalid. |
| 40 | // |
| 41 | // IMPORTANT: The time reported is not the wallclock time reading at the time |
| 42 | // of the update, rather it is the point in time when the update completed |
| 43 | // relative to the current wallclock time reading. Therefore, the gap between |
| 44 | // the reported value and the current wallclock time is guaranteed to be |
| 45 | // monotonically increasing. |
| 46 | virtual Variable<base::Time>* var_update_completed_time() = 0; |
| 47 | |
| 48 | // A variable returning the update progress (0.0 to 1.0). |
| 49 | virtual Variable<double>* var_progress() = 0; |
| 50 | |
| 51 | // A variable returning the current update status. |
| 52 | virtual Variable<Stage>* var_stage() = 0; |
| 53 | |
| 54 | // A variable returning the update target version. |
| 55 | virtual Variable<std::string>* var_new_version() = 0; |
| 56 | |
| 57 | // A variable returning the update payload size. |
| 58 | virtual Variable<size_t>* var_payload_size() = 0; |
| 59 | |
| 60 | // A variable returning the current channel. |
| 61 | virtual Variable<std::string>* var_curr_channel() = 0; |
| 62 | |
| 63 | // A variable returning the update target channel. |
| 64 | virtual Variable<std::string>* var_new_channel() = 0; |
| 65 | |
| 66 | // A variable indicating whether P2P updates are allowed. |
| 67 | virtual Variable<bool>* var_p2p_enabled() = 0; |
| 68 | |
| 69 | // A variable indicating whether updates are allowed over a cellular network. |
| 70 | virtual Variable<bool>* var_cellular_enabled() = 0; |
| 71 | }; |
| 72 | |
| 73 | } // namespace chromeos_policy_manager |
| 74 | |
| 75 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_POLICY_MANAGER_UPDATER_PROVIDER_H_ |