Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/browser/component_updater/component_updater_service.h

Issue 18516010: Implemented completion pings for component updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace net {
15 class URLRequestContextGetter;
16 }
17
18 namespace base { 14 namespace base {
19 class DictionaryValue; 15 class DictionaryValue;
20 class FilePath; 16 class FilePath;
21 } 17 }
22 18
19 namespace net {
20 class URLRequestContextGetter;
21 }
22
23 class ComponentPatcher; 23 class ComponentPatcher;
24 24
25 // Component specific installers must derive from this class and implement 25 // Component specific installers must derive from this class and implement
26 // OnUpdateError() and Install(). A valid instance of this class must be 26 // OnUpdateError() and Install(). A valid instance of this class must be
27 // given to ComponentUpdateService::RegisterComponent(). 27 // given to ComponentUpdateService::RegisterComponent().
28 class ComponentInstaller { 28 class ComponentInstaller {
29 public : 29 public :
30 // Called by the component updater on the UI thread when there was a 30 // Called by the component updater on the UI thread when there was a
31 // problem unpacking or verifying the component. |error| is a non-zero 31 // problem unpacking or verifying the component. |error| is a non-zero
32 // value which is only meaningful to the component updater. 32 // value which is only meaningful to the component updater.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 public: 84 public:
85 enum Status { 85 enum Status {
86 kOk, 86 kOk,
87 kReplaced, 87 kReplaced,
88 kInProgress, 88 kInProgress,
89 kError 89 kError
90 }; 90 };
91 // Controls the component updater behavior. 91 // Controls the component updater behavior.
92 class Configurator { 92 class Configurator {
93 public: 93 public:
94 enum Events {
95 kManifestCheck,
96 kComponentUpdated,
97 kManifestError,
98 kNetworkError,
99 kUnpackError,
100 kInstallerError
101 };
102
103 virtual ~Configurator() {} 94 virtual ~Configurator() {}
104 // Delay in seconds from calling Start() to the first update check. 95 // Delay in seconds from calling Start() to the first update check.
105 virtual int InitialDelay() = 0; 96 virtual int InitialDelay() = 0;
106 // Delay in seconds to every subsequent update check. 0 means don't check. 97 // Delay in seconds to every subsequent update check. 0 means don't check.
107 virtual int NextCheckDelay() = 0; 98 virtual int NextCheckDelay() = 0;
108 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. 99 // Delay in seconds from each task step. Used to smooth out CPU/IO usage.
109 virtual int StepDelay() = 0; 100 virtual int StepDelay() = 0;
110 // Minimum delta time in seconds before checking again the same component. 101 // Minimum delta time in seconds before checking again the same component.
111 virtual int MinimumReCheckWait() = 0; 102 virtual int MinimumReCheckWait() = 0;
112 // Minimum delta time in seconds before an on-demand check is allowed 103 // Minimum delta time in seconds before an on-demand check is allowed
113 // for the same component. 104 // for the same component.
114 virtual int OnDemandDelay() = 0; 105 virtual int OnDemandDelay() = 0;
115 // The url that is going to be used update checks over Omaha protocol. 106 // The url that is going to be used update checks over Omaha protocol.
116 virtual GURL UpdateUrl() = 0; 107 virtual GURL UpdateUrl() = 0;
108 // The url where the completion pings are sent. Invalid if and only if
109 // pings are disabled.
110 virtual GURL PingUrl() = 0;
117 // Parameters added to each url request. It can be null if none are needed. 111 // Parameters added to each url request. It can be null if none are needed.
118 virtual const char* ExtraRequestParams() = 0; 112 virtual const char* ExtraRequestParams() = 0;
119 // How big each update request can be. Don't go above 2000. 113 // How big each update request can be. Don't go above 2000.
120 virtual size_t UrlSizeLimit() = 0; 114 virtual size_t UrlSizeLimit() = 0;
121 // The source of contexts for all the url requests. 115 // The source of contexts for all the url requests.
122 virtual net::URLRequestContextGetter* RequestContext() = 0; 116 virtual net::URLRequestContextGetter* RequestContext() = 0;
123 // True means that all ops are performed in this process. 117 // True means that all ops are performed in this process.
124 virtual bool InProcess() = 0; 118 virtual bool InProcess() = 0;
125 // The component updater will call this function when an interesting event
126 // happens. It should be used mostly as a place to add application specific
127 // logging or telemetry. |extra| is |event| dependent.
128 virtual void OnEvent(Events event, int extra) = 0;
129 // Creates a new ComponentPatcher in a platform-specific way. This is useful 119 // Creates a new ComponentPatcher in a platform-specific way. This is useful
130 // for dependency injection. 120 // for dependency injection.
131 virtual ComponentPatcher* CreateComponentPatcher() = 0; 121 virtual ComponentPatcher* CreateComponentPatcher() = 0;
132 // True means that this client can handle delta updates. 122 // True means that this client can handle delta updates.
133 virtual bool DeltasEnabled() const = 0; 123 virtual bool DeltasEnabled() const = 0;
134 }; 124 };
135 125
136 // Start doing update checks and installing new versions of registered 126 // Start doing update checks and installing new versions of registered
137 // components after Configurator::InitialDelay() seconds. 127 // components after Configurator::InitialDelay() seconds.
138 virtual Status Start() = 0; 128 virtual Status Start() = 0;
(...skipping 19 matching lines...) Expand all
158 148
159 virtual ~ComponentUpdateService() {} 149 virtual ~ComponentUpdateService() {}
160 }; 150 };
161 151
162 // Creates the component updater. You must pass a valid |config| allocated on 152 // Creates the component updater. You must pass a valid |config| allocated on
163 // the heap which the component updater will own. 153 // the heap which the component updater will own.
164 ComponentUpdateService* ComponentUpdateServiceFactory( 154 ComponentUpdateService* ComponentUpdateServiceFactory(
165 ComponentUpdateService::Configurator* config); 155 ComponentUpdateService::Configurator* config);
166 156
167 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 157 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698