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, | |
144 ERROR_UPDATE_IN_PROGRESS = 1, | 143 ERROR_UPDATE_IN_PROGRESS = 1, |
145 ERROR_UPDATE_CANCELED = 2, | |
146 }; | 144 }; |
147 | 145 |
148 // Defines an interface for a generic CRX installer. | 146 // Defines an interface for a generic CRX installer. |
149 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { | 147 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { |
150 public: | 148 public: |
151 // Called on the main thread when there was a problem unpacking or | 149 // Called on the main thread when there was a problem unpacking or |
152 // verifying the CRX. |error| is a non-zero value which is only meaningful | 150 // verifying the CRX. |error| is a non-zero value which is only meaningful |
153 // to the caller. | 151 // to the caller. |
154 virtual void OnUpdateError(int error) = 0; | 152 virtual void OnUpdateError(int error) = 0; |
155 | 153 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 289 |
292 // Returns status details about a CRX update. The function returns true in | 290 // Returns status details about a CRX update. The function returns true in |
293 // case of success and false in case of errors, such as |id| was | 291 // case of success and false in case of errors, such as |id| was |
294 // invalid or not known. | 292 // invalid or not known. |
295 virtual bool GetCrxUpdateState(const std::string& id, | 293 virtual bool GetCrxUpdateState(const std::string& id, |
296 CrxUpdateItem* update_item) const = 0; | 294 CrxUpdateItem* update_item) const = 0; |
297 | 295 |
298 // Returns true if the |id| is found in any running task. | 296 // Returns true if the |id| is found in any running task. |
299 virtual bool IsUpdating(const std::string& id) const = 0; | 297 virtual bool IsUpdating(const std::string& id) const = 0; |
300 | 298 |
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 | |
307 protected: | 299 protected: |
308 friend class base::RefCounted<UpdateClient>; | 300 friend class base::RefCounted<UpdateClient>; |
309 | 301 |
310 virtual ~UpdateClient() {} | 302 virtual ~UpdateClient() {} |
311 }; | 303 }; |
312 | 304 |
313 // Creates an instance of the update client. | 305 // Creates an instance of the update client. |
314 scoped_refptr<UpdateClient> UpdateClientFactory( | 306 scoped_refptr<UpdateClient> UpdateClientFactory( |
315 const scoped_refptr<Configurator>& config); | 307 const scoped_refptr<Configurator>& config); |
316 | 308 |
317 } // namespace update_client | 309 } // namespace update_client |
318 | 310 |
319 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 311 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
OLD | NEW |