| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_INVALID_ARGUMENT = -1, |
| 144 ERROR_UPDATE_IN_PROGRESS = 1, | 144 ERROR_UPDATE_IN_PROGRESS = 1, |
| 145 ERROR_UPDATE_CANCELED = 2, | 145 ERROR_UPDATE_CANCELED = 2, |
| 146 ERROR_UPDATE_RETRY_LATER = 3, |
| 146 }; | 147 }; |
| 147 | 148 |
| 148 // Defines an interface for a generic CRX installer. | 149 // Defines an interface for a generic CRX installer. |
| 149 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { | 150 class CrxInstaller : public base::RefCountedThreadSafe<CrxInstaller> { |
| 150 public: | 151 public: |
| 151 // Called on the main thread when there was a problem unpacking or | 152 // 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 | 153 // verifying the CRX. |error| is a non-zero value which is only meaningful |
| 153 // to the caller. | 154 // to the caller. |
| 154 virtual void OnUpdateError(int error) = 0; | 155 virtual void OnUpdateError(int error) = 0; |
| 155 | 156 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 scoped_refptr<CrxInstaller> installer; | 191 scoped_refptr<CrxInstaller> installer; |
| 191 | 192 |
| 192 // The current version if the CRX is updated. Otherwise, "0" or "0.0" if | 193 // The current version if the CRX is updated. Otherwise, "0" or "0.0" if |
| 193 // the CRX is installed. | 194 // the CRX is installed. |
| 194 Version version; | 195 Version version; |
| 195 | 196 |
| 196 std::string fingerprint; // Optional. | 197 std::string fingerprint; // Optional. |
| 197 std::string name; // Optional. | 198 std::string name; // Optional. |
| 198 | 199 |
| 199 // Specifies that the CRX can be background-downloaded in some cases. | 200 // Specifies that the CRX can be background-downloaded in some cases. |
| 200 // The default for this value is |true| and the value can be overriden at | 201 // The default for this value is |true|. |
| 201 // the registration time. This is a temporary change until the issue | 202 bool allows_background_download; |
| 202 // crbug/340448 is resolved. | 203 |
| 203 bool allow_background_download; | 204 // Specifies that the update checks and pings associated with this component |
| 205 // require confidentiality. The default for this value is |true|. As a side |
| 206 // note, the confidentiality of the downloads is enforced by the server, |
| 207 // which only returns secure download URLs in this case. |
| 208 bool requires_network_encryption; |
| 204 }; | 209 }; |
| 205 | 210 |
| 206 // All methods are safe to call only from the browser's main thread. Once an | 211 // All methods are safe to call only from the browser's main thread. Once an |
| 207 // instance of this class is created, the reference to it must be released | 212 // instance of this class is created, the reference to it must be released |
| 208 // only after the thread pools of the browser process have been destroyed and | 213 // only after the thread pools of the browser process have been destroyed and |
| 209 // the browser process has gone single-threaded. | 214 // the browser process has gone single-threaded. |
| 210 class UpdateClient : public base::RefCounted<UpdateClient> { | 215 class UpdateClient : public base::RefCounted<UpdateClient> { |
| 211 public: | 216 public: |
| 212 using CrxDataCallback = | 217 using CrxDataCallback = |
| 213 base::Callback<void(const std::vector<std::string>& ids, | 218 base::Callback<void(const std::vector<std::string>& ids, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 virtual ~UpdateClient() {} | 325 virtual ~UpdateClient() {} |
| 321 }; | 326 }; |
| 322 | 327 |
| 323 // Creates an instance of the update client. | 328 // Creates an instance of the update client. |
| 324 scoped_refptr<UpdateClient> UpdateClientFactory( | 329 scoped_refptr<UpdateClient> UpdateClientFactory( |
| 325 const scoped_refptr<Configurator>& config); | 330 const scoped_refptr<Configurator>& config); |
| 326 | 331 |
| 327 } // namespace update_client | 332 } // namespace update_client |
| 328 | 333 |
| 329 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 334 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
| OLD | NEW |