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

Side by Side Diff: chrome/browser/search_engines/template_url_service_factory.cc

Issue 2334613003: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Changes from review by sky Created 4 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
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 #include "chrome/browser/search_engines/template_url_service_factory.h" 5 #include "chrome/browser/search_engines/template_url_service_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // static 42 // static
43 std::unique_ptr<KeyedService> TemplateURLServiceFactory::BuildInstanceFor( 43 std::unique_ptr<KeyedService> TemplateURLServiceFactory::BuildInstanceFor(
44 content::BrowserContext* context) { 44 content::BrowserContext* context) {
45 base::Closure dsp_change_callback; 45 base::Closure dsp_change_callback;
46 #if defined(ENABLE_RLZ) 46 #if defined(ENABLE_RLZ)
47 dsp_change_callback = base::Bind( 47 dsp_change_callback = base::Bind(
48 base::IgnoreResult(&rlz::RLZTracker::RecordProductEvent), rlz_lib::CHROME, 48 base::IgnoreResult(&rlz::RLZTracker::RecordProductEvent), rlz_lib::CHROME,
49 rlz::RLZTracker::ChromeOmnibox(), rlz_lib::SET_TO_GOOGLE); 49 rlz::RLZTracker::ChromeOmnibox(), rlz_lib::SET_TO_GOOGLE);
50 #endif 50 #endif
51 Profile* profile = static_cast<Profile*>(context); 51 Profile* profile = static_cast<Profile*>(context);
52 return base::WrapUnique(new TemplateURLService( 52 return base::MakeUnique<TemplateURLService>(
53 profile->GetPrefs(), 53 profile->GetPrefs(),
54 std::unique_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), 54 std::unique_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)),
55 WebDataServiceFactory::GetKeywordWebDataForProfile( 55 WebDataServiceFactory::GetKeywordWebDataForProfile(
56 profile, ServiceAccessType::EXPLICIT_ACCESS), 56 profile, ServiceAccessType::EXPLICIT_ACCESS),
57 std::unique_ptr<TemplateURLServiceClient>( 57 std::unique_ptr<TemplateURLServiceClient>(
58 new ChromeTemplateURLServiceClient( 58 new ChromeTemplateURLServiceClient(
59 HistoryServiceFactory::GetForProfile( 59 HistoryServiceFactory::GetForProfile(
60 profile, ServiceAccessType::EXPLICIT_ACCESS))), 60 profile, ServiceAccessType::EXPLICIT_ACCESS))),
61 GoogleURLTrackerFactory::GetForProfile(profile), 61 GoogleURLTrackerFactory::GetForProfile(profile),
62 g_browser_process->rappor_service(), dsp_change_callback)); 62 g_browser_process->rappor_service(), dsp_change_callback);
63 } 63 }
64 64
65 TemplateURLServiceFactory::TemplateURLServiceFactory() 65 TemplateURLServiceFactory::TemplateURLServiceFactory()
66 : BrowserContextKeyedServiceFactory( 66 : BrowserContextKeyedServiceFactory(
67 "TemplateURLServiceFactory", 67 "TemplateURLServiceFactory",
68 BrowserContextDependencyManager::GetInstance()) { 68 BrowserContextDependencyManager::GetInstance()) {
69 DependsOn(GoogleURLTrackerFactory::GetInstance()); 69 DependsOn(GoogleURLTrackerFactory::GetInstance());
70 DependsOn(HistoryServiceFactory::GetInstance()); 70 DependsOn(HistoryServiceFactory::GetInstance());
71 DependsOn(WebDataServiceFactory::GetInstance()); 71 DependsOn(WebDataServiceFactory::GetInstance());
72 } 72 }
(...skipping 12 matching lines...) Expand all
85 } 85 }
86 86
87 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( 87 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse(
88 content::BrowserContext* context) const { 88 content::BrowserContext* context) const {
89 return chrome::GetBrowserContextRedirectedInIncognito(context); 89 return chrome::GetBrowserContextRedirectedInIncognito(context);
90 } 90 }
91 91
92 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { 92 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const {
93 return true; 93 return true;
94 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698