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 <memory> | 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/version.h" | 17 #include "base/version.h" |
17 | 18 |
18 // The UpdateClient class is a facade with a simple interface. The interface | 19 // The UpdateClient class is a facade with a simple interface. The interface |
19 // exposes a few APIs to install a CRX or update a group of CRXs. | 20 // exposes a few APIs to install a CRX or update a group of CRXs. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // be uninstalled from disk. Returns true if uninstallation is supported, | 176 // be uninstalled from disk. Returns true if uninstallation is supported, |
176 // and false otherwise. | 177 // and false otherwise. |
177 virtual bool Uninstall() = 0; | 178 virtual bool Uninstall() = 0; |
178 | 179 |
179 protected: | 180 protected: |
180 friend class base::RefCountedThreadSafe<CrxInstaller>; | 181 friend class base::RefCountedThreadSafe<CrxInstaller>; |
181 | 182 |
182 virtual ~CrxInstaller() {} | 183 virtual ~CrxInstaller() {} |
183 }; | 184 }; |
184 | 185 |
| 186 // A dictionary of installer-specific, arbitrary name-value pairs, which |
| 187 // may be used in the update checks requests. |
| 188 using InstallerAttributes = std::map<std::string, std::string>; |
| 189 |
185 // TODO(sorin): this structure will be refactored soon. | 190 // TODO(sorin): this structure will be refactored soon. |
186 struct CrxComponent { | 191 struct CrxComponent { |
187 CrxComponent(); | 192 CrxComponent(); |
188 CrxComponent(const CrxComponent& other); | 193 CrxComponent(const CrxComponent& other); |
189 ~CrxComponent(); | 194 ~CrxComponent(); |
190 | 195 |
191 // SHA256 hash of the CRX's public key. | 196 // SHA256 hash of the CRX's public key. |
192 std::vector<uint8_t> pk_hash; | 197 std::vector<uint8_t> pk_hash; |
193 scoped_refptr<CrxInstaller> installer; | 198 scoped_refptr<CrxInstaller> installer; |
194 | 199 |
195 // The current version if the CRX is updated. Otherwise, "0" or "0.0" if | 200 // The current version if the CRX is updated. Otherwise, "0" or "0.0" if |
196 // the CRX is installed. | 201 // the CRX is installed. |
197 Version version; | 202 Version version; |
198 | 203 |
199 std::string fingerprint; // Optional. | 204 std::string fingerprint; // Optional. |
200 std::string name; // Optional. | 205 std::string name; // Optional. |
201 std::string ap; // Optional. Must match ^[-+_=a-zA-Z0-9]{0,256}$ | 206 |
| 207 // Optional. |
| 208 // Valid values for the name part of an attribute match |
| 209 // ^[-_a-zA-Z0-9]{1,256}$ and valid values the value part of an attribute |
| 210 // match ^[-.,;+_=a-zA-Z0-9]{0,256}$ . |
| 211 InstallerAttributes installer_attributes; |
202 | 212 |
203 // Specifies that the CRX can be background-downloaded in some cases. | 213 // Specifies that the CRX can be background-downloaded in some cases. |
204 // The default for this value is |true|. | 214 // The default for this value is |true|. |
205 bool allows_background_download; | 215 bool allows_background_download; |
206 | 216 |
207 // Specifies that the update checks and pings associated with this component | 217 // Specifies that the update checks and pings associated with this component |
208 // require confidentiality. The default for this value is |true|. As a side | 218 // require confidentiality. The default for this value is |true|. As a side |
209 // note, the confidentiality of the downloads is enforced by the server, | 219 // note, the confidentiality of the downloads is enforced by the server, |
210 // which only returns secure download URLs in this case. | 220 // which only returns secure download URLs in this case. |
211 bool requires_network_encryption; | 221 bool requires_network_encryption; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 scoped_refptr<UpdateClient> UpdateClientFactory( | 342 scoped_refptr<UpdateClient> UpdateClientFactory( |
333 const scoped_refptr<Configurator>& config); | 343 const scoped_refptr<Configurator>& config); |
334 | 344 |
335 // This must be called prior to the construction of any Configurator that | 345 // This must be called prior to the construction of any Configurator that |
336 // contains a PrefService. | 346 // contains a PrefService. |
337 void RegisterPrefs(PrefRegistrySimple* registry); | 347 void RegisterPrefs(PrefRegistrySimple* registry); |
338 | 348 |
339 } // namespace update_client | 349 } // namespace update_client |
340 | 350 |
341 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ | 351 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_CLIENT_H_ |
OLD | NEW |