| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
| 6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 class DictionaryValue; | 136 class DictionaryValue; |
| 137 class FilePath; | 137 class FilePath; |
| 138 } | 138 } |
| 139 | 139 |
| 140 namespace update_client { | 140 namespace update_client { |
| 141 | 141 |
| 142 class Configurator; | 142 class Configurator; |
| 143 enum class Error; | 143 enum class Error; |
| 144 struct CrxUpdateItem; | 144 struct CrxUpdateItem; |
| 145 | 145 |
| 146 enum class ComponentState { |
| 147 kNew, |
| 148 kChecking, |
| 149 kCanUpdate, |
| 150 kDownloadingDiff, |
| 151 kDownloading, |
| 152 kDownloaded, |
| 153 kUpdatingDiff, |
| 154 kUpdating, |
| 155 kUpdated, |
| 156 kUpToDate, |
| 157 kUpdateError, |
| 158 kUninstalled, |
| 159 kLastStatus |
| 160 }; |
| 161 |
| 146 // Called when a non-blocking call in this module completes. | 162 // Called when a non-blocking call in this module completes. |
| 147 using Callback = base::Callback<void(Error error)>; | 163 using Callback = base::Callback<void(Error error)>; |
| 148 | 164 |
| 149 // Defines an interface for a generic CRX installer. | 165 // Defines an interface for a generic CRX installer. |
| 150 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { | 166 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { |
| 151 public: | 167 public: |
| 152 // Contains the result of the Install operation. | 168 // Contains the result of the Install operation. |
| 153 struct Result { | 169 struct Result { |
| 154 explicit Result(int error, int extended_error = 0) | 170 explicit Result(int error, int extended_error = 0) |
| 155 : error(error), extended_error(extended_error) {} | 171 : error(error), extended_error(extended_error) {} |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 base::Callback<void(const std::vector<std::string>& ids, | 261 base::Callback<void(const std::vector<std::string>& ids, |
| 246 std::vector<CrxComponent>* components)>; | 262 std::vector<CrxComponent>* components)>; |
| 247 | 263 |
| 248 // Defines an interface to observe the UpdateClient. It provides | 264 // Defines an interface to observe the UpdateClient. It provides |
| 249 // notifications when state changes occur for the service itself or for the | 265 // notifications when state changes occur for the service itself or for the |
| 250 // registered CRXs. | 266 // registered CRXs. |
| 251 class Observer { | 267 class Observer { |
| 252 public: | 268 public: |
| 253 enum class Events { | 269 enum class Events { |
| 254 // Sent before the update client does an update check. | 270 // Sent before the update client does an update check. |
| 255 COMPONENT_CHECKING_FOR_UPDATES, | 271 COMPONENT_CHECKING_FOR_UPDATES = 1, |
| 256 | 272 |
| 257 // Sent when there is a new version of a registered CRX. After | 273 // Sent when there is a new version of a registered CRX. After |
| 258 // the notification is sent the CRX will be downloaded unless the | 274 // the notification is sent the CRX will be downloaded unless the |
| 259 // update client inserts a | 275 // update client inserts a |
| 260 COMPONENT_UPDATE_FOUND, | 276 COMPONENT_UPDATE_FOUND, |
| 261 | 277 |
| 262 // Sent when a CRX is in the update queue but it can't be acted on | 278 // Sent when a CRX is in the update queue but it can't be acted on |
| 263 // right away, because the update client spaces out CRX updates due to a | 279 // right away, because the update client spaces out CRX updates due to a |
| 264 // throttling policy. | 280 // throttling policy. |
| 265 COMPONENT_WAIT, | 281 COMPONENT_WAIT, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 scoped_refptr<UpdateClient> UpdateClientFactory( | 372 scoped_refptr<UpdateClient> UpdateClientFactory( |
| 357 const scoped_refptr<Configurator>& config); | 373 const scoped_refptr<Configurator>& config); |
| 358 | 374 |
| 359 // This must be called prior to the construction of any Configurator that | 375 // This must be called prior to the construction of any Configurator that |
| 360 // contains a PrefService. | 376 // contains a PrefService. |
| 361 void RegisterPrefs(PrefRegistrySimple* registry); | 377 void RegisterPrefs(PrefRegistrySimple* registry); |
| 362 | 378 |
| 363 } // namespace update_client | 379 } // namespace update_client |
| 364 | 380 |
| 365 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 381 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
| OLD | NEW |