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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 protected: | 41 protected: |
42 virtual ~ComponentInstaller() {} | 42 virtual ~ComponentInstaller() {} |
43 }; | 43 }; |
44 | 44 |
45 // Describes a particular component that can be installed or updated. This | 45 // Describes a particular component that can be installed or updated. This |
46 // structure is required to register a component with the component updater. | 46 // 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 | 47 // 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 | 48 // 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. | 49 // "0" or "0.0", else it should be the current version. |
| 50 // |source| is by default pointing to BANDAID but if needed it can be made |
| 51 // to point to the webstore (CWS_PUBLIC) or to the webstore sandbox. It is |
| 52 // important to note that the BANDAID source if active throught the day |
| 53 // can pre-empt updates from the other sources down the list. |
50 struct CrxComponent { | 54 struct CrxComponent { |
| 55 // Specifies the source url for manifest check. |
| 56 enum UrlSource { |
| 57 BANDAID, |
| 58 CWS_PUBLIC, |
| 59 CWS_SANDBOX |
| 60 }; |
| 61 |
51 std::vector<uint8> pk_hash; | 62 std::vector<uint8> pk_hash; |
52 ComponentInstaller* installer; | 63 ComponentInstaller* installer; |
53 Version version; | 64 Version version; |
54 std::string name; | 65 std::string name; |
| 66 UrlSource source; |
55 CrxComponent(); | 67 CrxComponent(); |
56 ~CrxComponent(); | 68 ~CrxComponent(); |
57 }; | 69 }; |
58 | 70 |
59 // The component update service is in charge of installing or upgrading | 71 // The component update service is in charge of installing or upgrading |
60 // select parts of chrome. Each part is called a component and managed by | 72 // select parts of chrome. Each part is called a component and managed by |
61 // instances of CrxComponent registered using RegisterComponent(). On the | 73 // instances of CrxComponent registered using RegisterComponent(). On the |
62 // server, each component is packaged as a CRX which is the same format used | 74 // server, each component is packaged as a CRX which is the same format used |
63 // to package extensions. To the update service each component is identified | 75 // to package extensions. To the update service each component is identified |
64 // by its public key hash (CrxComponent::pk_hash). If there is an update | 76 // by its public key hash (CrxComponent::pk_hash). If there is an update |
(...skipping 28 matching lines...) Expand all Loading... |
93 virtual ~Configurator() {} | 105 virtual ~Configurator() {} |
94 // Delay in seconds from calling Start() to the first update check. | 106 // Delay in seconds from calling Start() to the first update check. |
95 virtual int InitialDelay() = 0; | 107 virtual int InitialDelay() = 0; |
96 // Delay in seconds to every subsequent update check. 0 means don't check. | 108 // Delay in seconds to every subsequent update check. 0 means don't check. |
97 virtual int NextCheckDelay() = 0; | 109 virtual int NextCheckDelay() = 0; |
98 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. | 110 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. |
99 virtual int StepDelay() = 0; | 111 virtual int StepDelay() = 0; |
100 // Minimun delta time in seconds before checking again the same component. | 112 // Minimun delta time in seconds before checking again the same component. |
101 virtual int MinimumReCheckWait() = 0; | 113 virtual int MinimumReCheckWait() = 0; |
102 // The url that is going to be used update checks over Omaha protocol. | 114 // The url that is going to be used update checks over Omaha protocol. |
103 virtual GURL UpdateUrl() = 0; | 115 virtual GURL UpdateUrl(CrxComponent::UrlSource source) = 0; |
104 // Parameters added to each url request. It can be null if none are needed. | 116 // Parameters added to each url request. It can be null if none are needed. |
105 virtual const char* ExtraRequestParams() = 0; | 117 virtual const char* ExtraRequestParams() = 0; |
106 // How big each update request can be. Don't go above 2000. | 118 // How big each update request can be. Don't go above 2000. |
107 virtual size_t UrlSizeLimit() = 0; | 119 virtual size_t UrlSizeLimit() = 0; |
108 // The source of contexts for all the url requests. | 120 // The source of contexts for all the url requests. |
109 virtual net::URLRequestContextGetter* RequestContext() = 0; | 121 virtual net::URLRequestContextGetter* RequestContext() = 0; |
110 // True means that all ops are performed in this process. | 122 // True means that all ops are performed in this process. |
111 virtual bool InProcess() = 0; | 123 virtual bool InProcess() = 0; |
112 // The component updater will call this function when an interesting event | 124 // The component updater will call this function when an interesting event |
113 // happens. It should be used mostly as a place to add application specific | 125 // happens. It should be used mostly as a place to add application specific |
(...skipping 16 matching lines...) Expand all Loading... |
130 virtual ~ComponentUpdateService() {} | 142 virtual ~ComponentUpdateService() {} |
131 }; | 143 }; |
132 | 144 |
133 // Creates the component updater. You must pass a valid |config| allocated on | 145 // Creates the component updater. You must pass a valid |config| allocated on |
134 // the heap which the component updater will own. | 146 // the heap which the component updater will own. |
135 ComponentUpdateService* ComponentUpdateServiceFactory( | 147 ComponentUpdateService* ComponentUpdateServiceFactory( |
136 ComponentUpdateService::Configurator* config); | 148 ComponentUpdateService::Configurator* config); |
137 | 149 |
138 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 150 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
139 | 151 |
OLD | NEW |