OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 class FilePath; | |
15 | |
16 namespace net { | 14 namespace net { |
17 class URLRequestContextGetter; | 15 class URLRequestContextGetter; |
18 } | 16 } |
19 | 17 |
20 namespace base { | 18 namespace base { |
21 class DictionaryValue; | 19 class DictionaryValue; |
| 20 class FilePath; |
22 } | 21 } |
23 | 22 |
24 // Component specific installers must derive from this class and implement | 23 // Component specific installers must derive from this class and implement |
25 // OnUpdateError() and Install(). A valid instance of this class must be | 24 // OnUpdateError() and Install(). A valid instance of this class must be |
26 // given to ComponentUpdateService::RegisterComponent(). | 25 // given to ComponentUpdateService::RegisterComponent(). |
27 class ComponentInstaller { | 26 class ComponentInstaller { |
28 public : | 27 public : |
29 // Called by the component updater on the UI thread when there was a | 28 // Called by the component updater on the UI thread when there was a |
30 // problem unpacking or verifying the component. |error| is a non-zero | 29 // problem unpacking or verifying the component. |error| is a non-zero |
31 // value which is only meaninful to the component updater. | 30 // value which is only meaninful to the component updater. |
32 virtual void OnUpdateError(int error) = 0; | 31 virtual void OnUpdateError(int error) = 0; |
33 | 32 |
34 // Called by the component updater when a component has been unpacked | 33 // Called by the component updater when a component has been unpacked |
35 // and is ready to be installed. |manifest| contains the CRX manifest | 34 // and is ready to be installed. |manifest| contains the CRX manifest |
36 // json dictionary and |unpack_path| contains the temporary directory | 35 // json dictionary and |unpack_path| contains the temporary directory |
37 // with all the unpacked CRX files. | 36 // with all the unpacked CRX files. |
38 virtual bool Install(base::DictionaryValue* manifest, | 37 virtual bool Install(base::DictionaryValue* manifest, |
39 const FilePath& unpack_path) = 0; | 38 const base::FilePath& unpack_path) = 0; |
40 | 39 |
41 protected: | 40 protected: |
42 virtual ~ComponentInstaller() {} | 41 virtual ~ComponentInstaller() {} |
43 }; | 42 }; |
44 | 43 |
45 // Describes a particular component that can be installed or updated. This | 44 // Describes a particular component that can be installed or updated. This |
46 // structure is required to register a component with the component updater. | 45 // structure is required to register a component with the component updater. |
47 // Only |name| is optional. |pk_hash| is the SHA256 hash of the component's | 46 // Only |name| is optional. |pk_hash| is the SHA256 hash of the component's |
48 // public key. If the component is to be installed then version should be | 47 // public key. If the component is to be installed then version should be |
49 // "0" or "0.0", else it should be the current version. | 48 // "0" or "0.0", else it should be the current version. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 virtual ~ComponentUpdateService() {} | 141 virtual ~ComponentUpdateService() {} |
143 }; | 142 }; |
144 | 143 |
145 // Creates the component updater. You must pass a valid |config| allocated on | 144 // Creates the component updater. You must pass a valid |config| allocated on |
146 // the heap which the component updater will own. | 145 // the heap which the component updater will own. |
147 ComponentUpdateService* ComponentUpdateServiceFactory( | 146 ComponentUpdateService* ComponentUpdateServiceFactory( |
148 ComponentUpdateService::Configurator* config); | 147 ComponentUpdateService::Configurator* config); |
149 | 148 |
150 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 149 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
151 | 150 |
OLD | NEW |