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

Side by Side Diff: chrome/browser/ui/views/frame/test_with_browser_view.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/views/frame/test_with_browser_view.h" 5 #include "chrome/browser/ui/views/frame/test_with_browser_view.h"
6 6
7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
9 #include "chrome/browser/autocomplete/autocomplete_controller.h" 9 #include "chrome/browser/autocomplete/autocomplete_controller.h"
10 #include "chrome/browser/history/history_service_factory.h" 10 #include "chrome/browser/history/history_service_factory.h"
(...skipping 13 matching lines...) Expand all
24 #include "components/search_engines/template_url_service.h" 24 #include "components/search_engines/template_url_service.h"
25 #include "content/public/test/test_utils.h" 25 #include "content/public/test/test_utils.h"
26 26
27 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
28 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 28 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
29 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 29 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
30 #endif 30 #endif
31 31
32 namespace { 32 namespace {
33 33
34 // Caller owns the returned service. 34 scoped_ptr<KeyedService> CreateTemplateURLService(
35 KeyedService* CreateTemplateURLService(content::BrowserContext* context) { 35 content::BrowserContext* context) {
36 Profile* profile = static_cast<Profile*>(context); 36 Profile* profile = static_cast<Profile*>(context);
37 return new TemplateURLService( 37 return make_scoped_ptr(new TemplateURLService(
38 profile->GetPrefs(), 38 profile->GetPrefs(),
39 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), 39 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)),
40 WebDataServiceFactory::GetKeywordWebDataForProfile( 40 WebDataServiceFactory::GetKeywordWebDataForProfile(
41 profile, ServiceAccessType::EXPLICIT_ACCESS), 41 profile, ServiceAccessType::EXPLICIT_ACCESS),
42 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( 42 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient(
43 HistoryServiceFactory::GetForProfile( 43 HistoryServiceFactory::GetForProfile(
44 profile, ServiceAccessType::EXPLICIT_ACCESS))), 44 profile, ServiceAccessType::EXPLICIT_ACCESS))),
45 nullptr, nullptr, base::Closure()); 45 nullptr, nullptr, base::Closure()));
46 } 46 }
47 47
48 KeyedService* CreateAutocompleteClassifier(content::BrowserContext* context) { 48 scoped_ptr<KeyedService> CreateAutocompleteClassifier(
49 content::BrowserContext* context) {
49 Profile* profile = static_cast<Profile*>(context); 50 Profile* profile = static_cast<Profile*>(context);
50 return new AutocompleteClassifier( 51 return make_scoped_ptr(new AutocompleteClassifier(
51 make_scoped_ptr(new AutocompleteController( 52 make_scoped_ptr(new AutocompleteController(
52 profile, TemplateURLServiceFactory::GetForProfile(profile), nullptr, 53 profile, TemplateURLServiceFactory::GetForProfile(profile), nullptr,
53 AutocompleteClassifier::kDefaultOmniboxProviders)), 54 AutocompleteClassifier::kDefaultOmniboxProviders)),
54 scoped_ptr<AutocompleteSchemeClassifier>(new TestSchemeClassifier())); 55 scoped_ptr<AutocompleteSchemeClassifier>(new TestSchemeClassifier())));
55 } 56 }
56 57
57 } // namespace 58 } // namespace
58 59
59 TestWithBrowserView::TestWithBrowserView() { 60 TestWithBrowserView::TestWithBrowserView() {
60 } 61 }
61 62
62 TestWithBrowserView::TestWithBrowserView( 63 TestWithBrowserView::TestWithBrowserView(
63 Browser::Type browser_type, 64 Browser::Type browser_type,
64 chrome::HostDesktopType host_desktop_type, 65 chrome::HostDesktopType host_desktop_type,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory( 117 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory(
117 profile, &CreateAutocompleteClassifier); 118 profile, &CreateAutocompleteClassifier);
118 return profile; 119 return profile;
119 } 120 }
120 121
121 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() { 122 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() {
122 // Allow BrowserWithTestWindowTest to use Browser to create the default 123 // Allow BrowserWithTestWindowTest to use Browser to create the default
123 // BrowserView and BrowserFrame. 124 // BrowserView and BrowserFrame.
124 return nullptr; 125 return nullptr;
125 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698