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

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: clean up forward decls in CMSA 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 void set_brand_code(const std::string& brand_code) {
104 brand_code_ = brand_code;
105 }
106
107 void set_manifest_query_params(const std::string& params) {
108 manifest_query_params_ = params;
109 }
110
111 void set_ping_enabled_domain(const std::string& domain) {
112 ping_enabled_domain_ = domain;
113 }
114
115 void set_enable_extra_update_metrics(bool enable) {
116 enable_extra_update_metrics_ = enable;
117 }
118
103 // These are needed for unit testing, to help identify the correct mock 119 // These are needed for unit testing, to help identify the correct mock
104 // URLFetcher objects. 120 // URLFetcher objects.
105 static const int kManifestFetcherId = 1; 121 static const int kManifestFetcherId = 1;
106 static const int kExtensionFetcherId = 2; 122 static const int kExtensionFetcherId = 2;
107 123
108 // Update AppID for extension blacklist. 124 // Update AppID for extension blacklist.
109 static const char kBlacklistAppID[]; 125 static const char kBlacklistAppID[];
110 126
111 static const int kMaxRetries = 10; 127 static const int kMaxRetries = 10;
112 128
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 const net::URLRequestStatus& status, 253 const net::URLRequestStatus& status,
238 int response_code); 254 int response_code);
239 255
240 // OAuth2TokenService::Consumer implementation. 256 // OAuth2TokenService::Consumer implementation.
241 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 257 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
242 const std::string& access_token, 258 const std::string& access_token,
243 const base::Time& expiration_time) OVERRIDE; 259 const base::Time& expiration_time) OVERRIDE;
244 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, 260 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
245 const GoogleServiceAuthError& error) OVERRIDE; 261 const GoogleServiceAuthError& error) OVERRIDE;
246 262
263 ManifestFetchData* CreateManifestFetchData(const GURL& update_url,
264 int request_id);
265
247 // The delegate that receives the crx files downloaded by the 266 // The delegate that receives the crx files downloaded by the
248 // ExtensionDownloader, and that fills in optional ping and update url data. 267 // ExtensionDownloader, and that fills in optional ping and update url data.
249 ExtensionDownloaderDelegate* delegate_; 268 ExtensionDownloaderDelegate* delegate_;
250 269
251 // The request context to use for the URLFetchers. 270 // The request context to use for the URLFetchers.
252 scoped_refptr<net::URLRequestContextGetter> request_context_; 271 scoped_refptr<net::URLRequestContextGetter> request_context_;
253 272
254 // Used to create WeakPtrs to |this|. 273 // Used to create WeakPtrs to |this|.
255 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_; 274 base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_;
256 275
(...skipping 27 matching lines...) Expand all
284 // download requests. May be NULL. 303 // download requests. May be NULL.
285 scoped_ptr<IdentityProvider> identity_provider_; 304 scoped_ptr<IdentityProvider> identity_provider_;
286 305
287 // A Webstore download-scoped access token for the |identity_provider_|'s 306 // A Webstore download-scoped access token for the |identity_provider_|'s
288 // active account, if any. 307 // active account, if any.
289 std::string access_token_; 308 std::string access_token_;
290 309
291 // A pending token fetch request. 310 // A pending token fetch request.
292 scoped_ptr<OAuth2TokenService::Request> access_token_request_; 311 scoped_ptr<OAuth2TokenService::Request> access_token_request_;
293 312
313 // Brand code to include with manifest fetch queries if sending ping data.
314 std::string brand_code_;
315
316 // Baseline parameters to include with manifest fetch queries.
317 std::string manifest_query_params_;
318
319 // Domain to enable ping data. Ping data will be sent with manifest fetches
320 // to update URLs which match this domain. Defaults to empty (no domain).
321 std::string ping_enabled_domain_;
322
323 // Indicates whether or not extra metrics should be included with ping data.
324 // Defaults to |false|.
325 bool enable_extra_update_metrics_;
326
294 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader); 327 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloader);
295 }; 328 };
296 329
297 } // namespace extensions 330 } // namespace extensions
298 331
299 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_ 332 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_DOWNLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698