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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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
OLDNEW
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
(...skipping 11 matching lines...) Expand all
22 #include "google_apis/gaia/identity_provider.h" 22 #include "google_apis/gaia/identity_provider.h"
23 23
24 using extensions::ExtensionDownloader; 24 using extensions::ExtensionDownloader;
25 using extensions::ExtensionDownloaderDelegate; 25 using extensions::ExtensionDownloaderDelegate;
26 using update_client::UpdateQueryParams; 26 using update_client::UpdateQueryParams;
27 27
28 namespace { 28 namespace {
29 const char kTestRequestParam[] = "extension-updater-test-request"; 29 const char kTestRequestParam[] = "extension-updater-test-request";
30 } // namespace 30 } // namespace
31 31
32 scoped_ptr<ExtensionDownloader> 32 std::unique_ptr<ExtensionDownloader>
33 ChromeExtensionDownloaderFactory::CreateForRequestContext( 33 ChromeExtensionDownloaderFactory::CreateForRequestContext(
34 net::URLRequestContextGetter* request_context, 34 net::URLRequestContextGetter* request_context,
35 ExtensionDownloaderDelegate* delegate) { 35 ExtensionDownloaderDelegate* delegate) {
36 scoped_ptr<ExtensionDownloader> downloader( 36 std::unique_ptr<ExtensionDownloader> downloader(
37 new ExtensionDownloader(delegate, request_context)); 37 new ExtensionDownloader(delegate, request_context));
38 #if defined(GOOGLE_CHROME_BUILD) 38 #if defined(GOOGLE_CHROME_BUILD)
39 std::string brand; 39 std::string brand;
40 google_brand::GetBrand(&brand); 40 google_brand::GetBrand(&brand);
41 if (!brand.empty() && !google_brand::IsOrganic(brand)) 41 if (!brand.empty() && !google_brand::IsOrganic(brand))
42 downloader->set_brand_code(brand); 42 downloader->set_brand_code(brand);
43 #endif // defined(GOOGLE_CHROME_BUILD) 43 #endif // defined(GOOGLE_CHROME_BUILD)
44 std::string manifest_query_params = 44 std::string manifest_query_params =
45 UpdateQueryParams::Get(UpdateQueryParams::CRX); 45 UpdateQueryParams::Get(UpdateQueryParams::CRX);
46 base::CommandLine* command_line = 46 base::CommandLine* command_line =
47 base::CommandLine::ForCurrentProcess(); 47 base::CommandLine::ForCurrentProcess();
48 if (command_line->HasSwitch(kTestRequestParam)) { 48 if (command_line->HasSwitch(kTestRequestParam)) {
49 manifest_query_params += "&testrequest=1"; 49 manifest_query_params += "&testrequest=1";
50 } 50 }
51 downloader->set_manifest_query_params(manifest_query_params); 51 downloader->set_manifest_query_params(manifest_query_params);
52 downloader->set_ping_enabled_domain("google.com"); 52 downloader->set_ping_enabled_domain("google.com");
53 downloader->set_enable_extra_update_metrics( 53 downloader->set_enable_extra_update_metrics(
54 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 54 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
55 return downloader; 55 return downloader;
56 } 56 }
57 57
58 scoped_ptr<ExtensionDownloader> 58 std::unique_ptr<ExtensionDownloader>
59 ChromeExtensionDownloaderFactory::CreateForProfile( 59 ChromeExtensionDownloaderFactory::CreateForProfile(
60 Profile* profile, 60 Profile* profile,
61 ExtensionDownloaderDelegate* delegate) { 61 ExtensionDownloaderDelegate* delegate) {
62 scoped_ptr<IdentityProvider> identity_provider(new ProfileIdentityProvider( 62 std::unique_ptr<IdentityProvider> identity_provider(
63 SigninManagerFactory::GetForProfile(profile), 63 new ProfileIdentityProvider(
64 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 64 SigninManagerFactory::GetForProfile(profile),
65 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))); 65 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
66 scoped_ptr<ExtensionDownloader> downloader = 66 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile)));
67 std::unique_ptr<ExtensionDownloader> downloader =
67 CreateForRequestContext(profile->GetRequestContext(), delegate); 68 CreateForRequestContext(profile->GetRequestContext(), delegate);
68 downloader->SetWebstoreIdentityProvider(std::move(identity_provider)); 69 downloader->SetWebstoreIdentityProvider(std::move(identity_provider));
69 return downloader; 70 return downloader;
70 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698