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

Side by Side Diff: chrome/browser/extensions/updater/extension_downloader.h

Issue 465543004: Factor Chrome details out of update manifest fetching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/version.h" 20 #include "base/version.h"
21 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h" 21 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h"
22 #include "chrome/browser/extensions/updater/manifest_fetch_data.h"
23 #include "chrome/browser/extensions/updater/request_queue.h" 22 #include "chrome/browser/extensions/updater/request_queue.h"
23 #include "extensions/browser/updater/manifest_fetch_data.h"
24 #include "extensions/common/extension.h" 24 #include "extensions/common/extension.h"
25 #include "extensions/common/update_manifest.h" 25 #include "extensions/common/update_manifest.h"
26 #include "google_apis/gaia/oauth2_token_service.h" 26 #include "google_apis/gaia/oauth2_token_service.h"
27 #include "net/url_request/url_fetcher_delegate.h" 27 #include "net/url_request/url_fetcher_delegate.h"
28 #include "url/gurl.h" 28 #include "url/gurl.h"
29 29
30 class IdentityProvider; 30 class IdentityProvider;
31 31
32 namespace net { 32 namespace net {
33 class URLFetcher; 33 class URLFetcher;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Schedules an update check of the blacklist. 93 // Schedules an update check of the blacklist.
94 void StartBlacklistUpdate(const std::string& version, 94 void StartBlacklistUpdate(const std::string& version,
95 const ManifestFetchData::PingData& ping_data, 95 const ManifestFetchData::PingData& ping_data,
96 int request_id); 96 int request_id);
97 97
98 // Sets an IdentityProvider to be used for OAuth2 authentication on protected 98 // Sets an IdentityProvider to be used for OAuth2 authentication on protected
99 // Webstore downloads. 99 // Webstore downloads.
100 void SetWebstoreIdentityProvider( 100 void SetWebstoreIdentityProvider(
101 scoped_ptr<IdentityProvider> identity_provider); 101 scoped_ptr<IdentityProvider> identity_provider);
102 102
103 // Sets the brand code to use when sending ping data with manifest fetches.
104 void SetBrandCode(const std::string& brand_code);
not at google - send to devlin 2014/08/13 01:30:02 Consider making these simpler set_brand_code metho
105
106 // Sets base parameters to include with manifest fetch queries.
107 void SetManifestQueryParams(const std::string& params);
108
109 // Enable ping data to be sent for update URLs matching a given domain.
110 void EnablePingDataForDomain(const std::string& domain);
111
112 // Enable extra metrics to be included along with ping data. Currently this
113 // includes a flag indicating each extension's enabled/disabled state.
114 void EnableExtraUpdateMetrics(bool enable);
115
103 // These are needed for unit testing, to help identify the correct mock 116 // These are needed for unit testing, to help identify the correct mock
104 // URLFetcher objects. 117 // URLFetcher objects.
105 static const int kManifestFetcherId = 1; 118 static const int kManifestFetcherId = 1;
106 static const int kExtensionFetcherId = 2; 119 static const int kExtensionFetcherId = 2;
107 120
108 // Update AppID for extension blacklist. 121 // Update AppID for extension blacklist.
109 static const char kBlacklistAppID[]; 122 static const char kBlacklistAppID[];
110 123
111 static const int kMaxRetries = 10; 124 static const int kMaxRetries = 10;
112 125
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 const net::URLRequestStatus& status, 250 const net::URLRequestStatus& status,
238 int response_code); 251 int response_code);
239 252
240 // OAuth2TokenService::Consumer implementation. 253 // OAuth2TokenService::Consumer implementation.
241 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 254 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
242 const std::string& access_token, 255 const std::string& access_token,
243 const base::Time& expiration_time) OVERRIDE; 256 const base::Time& expiration_time) OVERRIDE;
244 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, 257 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
245 const GoogleServiceAuthError& error) OVERRIDE; 258 const GoogleServiceAuthError& error) OVERRIDE;
246 259
260 ManifestFetchData* CreateManifestFetchData(const GURL& update_url,
261 int request_id);
262
247 // The delegate that receives the crx files downloaded by the 263 // The delegate that receives the crx files downloaded by the
248 // ExtensionDownloader, and that fills in optional ping and update url data. 264 // ExtensionDownloader, and that fills in optional ping and update url data.
249 ExtensionDownloaderDelegate* delegate_; 265 ExtensionDownloaderDelegate* delegate_;
250 266
251 // The request context to use for the URLFetchers. 267 // The request context to use for the URLFetchers.
252 scoped_refptr<net::URLRequestContextGetter> request_context_; 268 scoped_refptr<net::URLRequestContextGetter> request_context_;
253 269
254 // Used to create WeakPtrs to |this|. 270 // Used to create WeakPtrs to |this|.
255 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; 271 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_;
256 272
(...skipping 27 matching lines...) Expand all
284 // download requests. May be NULL. 300 // download requests. May be NULL.
285 scoped_ptr<IdentityProvider> identity_provider_; 301 scoped_ptr<IdentityProvider> identity_provider_;
286 302
287 // A Webstore download-scoped access token for the |identity_provider_|'s 303 // A Webstore download-scoped access token for the |identity_provider_|'s
288 // active account, if any. 304 // active account, if any.
289 std::string access_token_; 305 std::string access_token_;
290 306
291 // A pending token fetch request. 307 // A pending token fetch request.
292 scoped_ptr<OAuth2TokenService::Request> access_token_request_; 308 scoped_ptr<OAuth2TokenService::Request> access_token_request_;
293 309
310 // Brand code to include with manifest fetch queries if sending ping data.
311 std::string brand_code_;
312
313 // Baseline parameters to include with manifest fetch queries.
314 std::string manifest_query_params_;
315
316 // Domain to enable ping data. Ping data will be sent with manifest fetches
317 // to update URLs which match this domain. Defaults to empty (no domain).
318 std::string ping_enabled_domain_;
319
320 // Indicates whether or not extra metrics should be included with ping data.
321 // Defaults to |false|.
322 bool enable_extra_update_metrics_;
323
294 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); 324 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader);
295 }; 325 };
296 326
297 } // namespace extensions 327 } // namespace extensions
298 328
299 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ 329 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698