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

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

Issue 476073002: Revert of 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
(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/metrics/chrome_metrics_service_accessor.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/profile_identity_provider.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "chrome/browser/signin/signin_manager_factory.h"
13 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
14 #include "components/omaha_query_params/omaha_query_params.h"
15 #include "components/signin/core/browser/signin_manager.h"
16 #include "google_apis/gaia/identity_provider.h"
17
18 using extensions::ExtensionDownloader;
19 using extensions::ExtensionDownloaderDelegate;
20 using omaha_query_params::OmahaQueryParams;
21
22 scoped_ptr<ExtensionDownloader>
23 ChromeExtensionDownloaderFactory::CreateForRequestContext(
24 net::URLRequestContextGetter* request_context,
25 ExtensionDownloaderDelegate* delegate) {
26 scoped_ptr<ExtensionDownloader> downloader(
27 new ExtensionDownloader(delegate, request_context));
28 #if defined(GOOGLE_CHROME_BUILD)
29 std::string brand;
30 google_brand::GetBrand(&brand);
31 if (!brand.empty() && !google_brand::IsOrganic(brand))
32 downloader->set_brand_code(brand);
33 #endif // defined(GOOGLE_CHROME_BUILD)
34 downloader->set_manifest_query_params(
35 OmahaQueryParams::Get(OmahaQueryParams::CRX));
36 downloader->set_ping_enabled_domain("google.com");
37 downloader->set_enable_extra_update_metrics(
38 ChromeMetricsServiceAccessor::IsMetricsReportingEnabled());
39 return downloader.Pass();
40 }
41
42 scoped_ptr<ExtensionDownloader>
43 ChromeExtensionDownloaderFactory::CreateForProfile(
44 Profile* profile,
45 ExtensionDownloaderDelegate* delegate) {
46 scoped_ptr<IdentityProvider> identity_provider(new ProfileIdentityProvider(
47 SigninManagerFactory::GetForProfile(profile),
48 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
49 LoginUIServiceFactory::GetForProfile(profile)));
50 scoped_ptr<ExtensionDownloader> downloader =
51 CreateForRequestContext(profile->GetRequestContext(), delegate);
52 downloader->SetWebstoreIdentityProvider(identity_provider.Pass());
53 return downloader.Pass();
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698