| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory.
h" | 5 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory.
h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "chrome/browser/google/google_brand.h" | 12 #include "chrome/browser/google/google_brand.h" |
| 13 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | |
| 14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 16 #include "chrome/browser/signin/signin_manager_factory.h" | 15 #include "chrome/browser/signin/signin_manager_factory.h" |
| 17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 18 #include "components/signin/core/browser/profile_identity_provider.h" | 17 #include "components/signin/core/browser/profile_identity_provider.h" |
| 19 #include "components/signin/core/browser/signin_manager.h" | 18 #include "components/signin/core/browser/signin_manager.h" |
| 20 #include "components/update_client/update_query_params.h" | 19 #include "components/update_client/update_query_params.h" |
| 21 #include "extensions/browser/updater/extension_downloader.h" | 20 #include "extensions/browser/updater/extension_downloader.h" |
| 22 #include "google_apis/gaia/identity_provider.h" | 21 #include "google_apis/gaia/identity_provider.h" |
| 23 | 22 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 #endif // defined(GOOGLE_CHROME_BUILD) | 42 #endif // defined(GOOGLE_CHROME_BUILD) |
| 44 std::string manifest_query_params = | 43 std::string manifest_query_params = |
| 45 UpdateQueryParams::Get(UpdateQueryParams::CRX); | 44 UpdateQueryParams::Get(UpdateQueryParams::CRX); |
| 46 base::CommandLine* command_line = | 45 base::CommandLine* command_line = |
| 47 base::CommandLine::ForCurrentProcess(); | 46 base::CommandLine::ForCurrentProcess(); |
| 48 if (command_line->HasSwitch(kTestRequestParam)) { | 47 if (command_line->HasSwitch(kTestRequestParam)) { |
| 49 manifest_query_params += "&testrequest=1"; | 48 manifest_query_params += "&testrequest=1"; |
| 50 } | 49 } |
| 51 downloader->set_manifest_query_params(manifest_query_params); | 50 downloader->set_manifest_query_params(manifest_query_params); |
| 52 downloader->set_ping_enabled_domain("google.com"); | 51 downloader->set_ping_enabled_domain("google.com"); |
| 53 downloader->set_enable_extra_update_metrics( | |
| 54 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); | |
| 55 return downloader; | 52 return downloader; |
| 56 } | 53 } |
| 57 | 54 |
| 58 std::unique_ptr<ExtensionDownloader> | 55 std::unique_ptr<ExtensionDownloader> |
| 59 ChromeExtensionDownloaderFactory::CreateForProfile( | 56 ChromeExtensionDownloaderFactory::CreateForProfile( |
| 60 Profile* profile, | 57 Profile* profile, |
| 61 ExtensionDownloaderDelegate* delegate) { | 58 ExtensionDownloaderDelegate* delegate) { |
| 62 std::unique_ptr<IdentityProvider> identity_provider( | 59 std::unique_ptr<IdentityProvider> identity_provider( |
| 63 new ProfileIdentityProvider( | 60 new ProfileIdentityProvider( |
| 64 SigninManagerFactory::GetForProfile(profile), | 61 SigninManagerFactory::GetForProfile(profile), |
| 65 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 62 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 66 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))); | 63 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))); |
| 67 std::unique_ptr<ExtensionDownloader> downloader = | 64 std::unique_ptr<ExtensionDownloader> downloader = |
| 68 CreateForRequestContext(profile->GetRequestContext(), delegate); | 65 CreateForRequestContext(profile->GetRequestContext(), delegate); |
| 69 downloader->SetWebstoreIdentityProvider(std::move(identity_provider)); | 66 downloader->SetWebstoreIdentityProvider(std::move(identity_provider)); |
| 70 return downloader; | 67 return downloader; |
| 71 } | 68 } |
| OLD | NEW |