Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 enum UpdateStatusOperation { | 33 enum UpdateStatusOperation { |
| 34 UPDATE_STATUS_ERROR = -1, | 34 UPDATE_STATUS_ERROR = -1, |
| 35 UPDATE_STATUS_IDLE = 0, | 35 UPDATE_STATUS_IDLE = 0, |
| 36 UPDATE_STATUS_CHECKING_FOR_UPDATE, | 36 UPDATE_STATUS_CHECKING_FOR_UPDATE, |
| 37 UPDATE_STATUS_UPDATE_AVAILABLE, | 37 UPDATE_STATUS_UPDATE_AVAILABLE, |
| 38 UPDATE_STATUS_DOWNLOADING, | 38 UPDATE_STATUS_DOWNLOADING, |
| 39 UPDATE_STATUS_VERIFYING, | 39 UPDATE_STATUS_VERIFYING, |
| 40 UPDATE_STATUS_FINALIZING, | 40 UPDATE_STATUS_FINALIZING, |
| 41 UPDATE_STATUS_UPDATED_NEED_REBOOT, | 41 UPDATE_STATUS_UPDATED_NEED_REBOOT, |
| 42 UPDATE_STATUS_REPORTING_ERROR_EVENT, | 42 UPDATE_STATUS_REPORTING_ERROR_EVENT, |
| 43 UPDATE_STATUS_ATTEMPTING_ROLLBACK | 43 UPDATE_STATUS_ATTEMPTING_ROLLBACK, |
| 44 UPDATE_STATUS_NEED_PERMISSION_TO_UPDATE | |
|
Daniel Erat
2017/05/12 13:37:03
nit: put trailing comma after last item in lists
weidongg
2017/05/12 16:33:17
Done.
| |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 // The status of the ongoing update attempt. | 47 // The status of the ongoing update attempt. |
| 47 struct Status { | 48 struct Status { |
| 48 Status() : status(UPDATE_STATUS_IDLE), | 49 Status() : status(UPDATE_STATUS_IDLE), |
| 49 download_progress(0.0), | 50 download_progress(0.0), |
| 50 last_checked_time(0), | 51 last_checked_time(0), |
| 51 new_size(0) { | 52 new_size(0) { |
| 52 } | 53 } |
| 53 | 54 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 | 143 |
| 143 // Get EndOfLife status of the device and calls |callback| when completed. | 144 // Get EndOfLife status of the device and calls |callback| when completed. |
| 144 virtual void GetEolStatus(const GetEolStatusCallback& callback) = 0; | 145 virtual void GetEolStatus(const GetEolStatusCallback& callback) = 0; |
| 145 | 146 |
| 146 // Either allow or disallow receiving updates over cellular connections. | 147 // Either allow or disallow receiving updates over cellular connections. |
| 147 // Synchronous (blocking) method. | 148 // Synchronous (blocking) method. |
| 148 virtual void SetUpdateOverCellularPermission( | 149 virtual void SetUpdateOverCellularPermission( |
| 149 bool allowed, | 150 bool allowed, |
| 150 const base::Closure& callback) = 0; | 151 const base::Closure& callback) = 0; |
| 151 | 152 |
| 153 // Called once SetUpdateOverCellularTarget() is complete. Takes one parameter; | |
| 154 // - success: indicates whether the target is set successfully. | |
| 155 typedef base::Callback<void(bool)> SetTargetCallback; | |
|
Daniel Erat
2017/05/12 13:37:03
i think that 'using' is preferred now.
this shoul
weidongg
2017/05/12 16:33:17
Do you mean I should 'using base::Callback;' at th
Daniel Erat
2017/05/12 16:44:48
no, this:
using SetUpdateOverCellularTargetCall
weidongg
2017/05/12 17:00:15
Done.
| |
| 156 | |
| 157 // Set the target in the preferences maintained by update engine which then | |
| 158 // performs update to this given target after |RequestUpdateCheck| is invoked | |
|
Daniel Erat
2017/05/12 13:37:03
i think we usually just use || around variable nam
weidongg
2017/05/12 16:33:16
Done.
| |
| 159 // in the |callback|. | |
| 160 virtual void SetUpdateOverCellularTarget( | |
| 161 const std::string& target_version, | |
| 162 int64_t target_size, | |
|
Daniel Erat
2017/05/12 13:37:03
please document what target_version and target_siz
weidongg
2017/05/12 16:33:17
Ok, I add explanation.
| |
| 163 const SetTargetCallback& callback) = 0; | |
| 164 | |
| 152 // Returns an empty UpdateCheckCallback that does nothing. | 165 // Returns an empty UpdateCheckCallback that does nothing. |
| 153 static UpdateCheckCallback EmptyUpdateCheckCallback(); | 166 static UpdateCheckCallback EmptyUpdateCheckCallback(); |
| 154 | 167 |
| 155 // Creates the instance. | 168 // Creates the instance. |
| 156 static UpdateEngineClient* Create(DBusClientImplementationType type); | 169 static UpdateEngineClient* Create(DBusClientImplementationType type); |
| 157 | 170 |
| 158 // Returns true if |target_channel| is more stable than |current_channel|. | 171 // Returns true if |target_channel| is more stable than |current_channel|. |
| 159 static bool IsTargetChannelMoreStable(const std::string& current_channel, | 172 static bool IsTargetChannelMoreStable(const std::string& current_channel, |
| 160 const std::string& target_channel); | 173 const std::string& target_channel); |
| 161 | 174 |
| 162 protected: | 175 protected: |
| 163 // Create() should be used instead. | 176 // Create() should be used instead. |
| 164 UpdateEngineClient(); | 177 UpdateEngineClient(); |
| 165 | 178 |
| 166 private: | 179 private: |
| 167 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClient); | 180 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClient); |
| 168 }; | 181 }; |
| 169 | 182 |
| 170 } // namespace chromeos | 183 } // namespace chromeos |
| 171 | 184 |
| 172 #endif // CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ | 185 #endif // CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ |
| OLD | NEW |