| 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 class DictionaryValue; | 133 class DictionaryValue; |
| 134 class FilePath; | 134 class FilePath; |
| 135 } | 135 } |
| 136 | 136 |
| 137 namespace update_client { | 137 namespace update_client { |
| 138 | 138 |
| 139 class Configurator; | 139 class Configurator; |
| 140 struct CrxUpdateItem; | 140 struct CrxUpdateItem; |
| 141 | 141 |
| 142 enum Error { | 142 enum Error { |
| 143 ERROR_UPDATE_INVALID_ARGUMENT = -1, |
| 143 ERROR_UPDATE_IN_PROGRESS = 1, | 144 ERROR_UPDATE_IN_PROGRESS = 1, |
| 145 ERROR_UPDATE_CANCELED = 2, |
| 144 }; | 146 }; |
| 145 | 147 |
| 146 // Defines an interface for a generic CRX installer. | 148 // Defines an interface for a generic CRX installer. |
| 147 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { | 149 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { |
| 148 public: | 150 public: |
| 149 // Called on the main thread when there was a problem unpacking or | 151 // Called on the main thread when there was a problem unpacking or |
| 150 // verifying the CRX. |error| is a non-zero value which is only meaningful | 152 // verifying the CRX. |error| is a non-zero value which is only meaningful |
| 151 // to the caller. | 153 // to the caller. |
| 152 virtual void OnUpdateError(int error) = 0; | 154 virtual void OnUpdateError(int error) = 0; |
| 153 | 155 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 291 |
| 290 // Returns status details about a CRX update. The function returns true in | 292 // Returns status details about a CRX update. The function returns true in |
| 291 // case of success and false in case of errors, such as |id| was | 293 // case of success and false in case of errors, such as |id| was |
| 292 // invalid or not known. | 294 // invalid or not known. |
| 293 virtual bool GetCrxUpdateState(const std::string& id, | 295 virtual bool GetCrxUpdateState(const std::string& id, |
| 294 CrxUpdateItem* update_item) const = 0; | 296 CrxUpdateItem* update_item) const = 0; |
| 295 | 297 |
| 296 // Returns true if the |id| is found in any running task. | 298 // Returns true if the |id| is found in any running task. |
| 297 virtual bool IsUpdating(const std::string& id) const = 0; | 299 virtual bool IsUpdating(const std::string& id) const = 0; |
| 298 | 300 |
| 301 // Cancels the queued updates and makes a best effort to stop updates in |
| 302 // progress as soon as possible. Some updates may not be stopped, in which |
| 303 // case, the updates will run to completion. Calling this function has no |
| 304 // effect if updates are not currently executed or queued up. |
| 305 virtual void Stop() = 0; |
| 306 |
| 299 protected: | 307 protected: |
| 300 friend class base::RefCounted<UpdateClient>; | 308 friend class base::RefCounted<UpdateClient>; |
| 301 | 309 |
| 302 virtual ~UpdateClient() {} | 310 virtual ~UpdateClient() {} |
| 303 }; | 311 }; |
| 304 | 312 |
| 305 // Creates an instance of the update client. | 313 // Creates an instance of the update client. |
| 306 scoped_refptr<UpdateClient> UpdateClientFactory( | 314 scoped_refptr<UpdateClient> UpdateClientFactory( |
| 307 const scoped_refptr<Configurator>& config); | 315 const scoped_refptr<Configurator>& config); |
| 308 | 316 |
| 309 } // namespace update_client | 317 } // namespace update_client |
| 310 | 318 |
| 311 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 319 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
| OLD | NEW |