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

Side by Side Diff: chrome/browser/extensions/updater/chrome_extension_downloader_factory.cc

Issue 475423002: Reland: Factor Chrome details out of update manifest fetching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uh merge fail? Created 6 years, 3 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory. h"
6
7 #include "chrome/browser/extensions/updater/extension_downloader.h"
8 #include "chrome/browser/google/google_brand.h"
9 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/signin/profile_identity_provider.h"
12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
13 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
15 #include "components/omaha_query_params/omaha_query_params.h"
16 #include "components/signin/core/browser/signin_manager.h"
17 #include "google_apis/gaia/identity_provider.h"
18
19 using extensions::ExtensionDownloader;
20 using extensions::ExtensionDownloaderDelegate;
21 using omaha_query_params::OmahaQueryParams;
22
23 scoped_ptr<ExtensionDownloader>
24 ChromeExtensionDownloaderFactory::CreateForRequestContext(
25 net::URLRequestContextGetter* request_context,
26 ExtensionDownloaderDelegate* delegate) {
27 scoped_ptr<ExtensionDownloader> downloader(
28 new ExtensionDownloader(delegate, request_context));
29 #if defined(GOOGLE_CHROME_BUILD)
30 std::string brand;
31 google_brand::GetBrand(&brand);
32 if (!brand.empty() && !google_brand::IsOrganic(brand))
33 downloader->set_brand_code(brand);
34 #endif // defined(GOOGLE_CHROME_BUILD)
35 downloader->set_manifest_query_params(
36 OmahaQueryParams::Get(OmahaQueryParams::CRX));
37 downloader->set_ping_enabled_domain("google.com");
38 downloader->set_enable_extra_update_metrics(
39 ChromeMetricsServiceAccessor::IsMetricsReportingEnabled());
40 return downloader.Pass();
41 }
42
43 scoped_ptr<ExtensionDownloader>
44 ChromeExtensionDownloaderFactory::CreateForProfile(
45 Profile* profile,
46 ExtensionDownloaderDelegate* delegate) {
47 scoped_ptr<IdentityProvider> identity_provider(new ProfileIdentityProvider(
48 SigninManagerFactory::GetForProfile(profile),
49 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
50 LoginUIServiceFactory::GetForProfile(profile)));
51 scoped_ptr<ExtensionDownloader> downloader =
52 CreateForRequestContext(profile->GetRequestContext(), delegate);
53 downloader->SetWebstoreIdentityProvider(identity_provider.Pass());
54 return downloader.Pass();
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698