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

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

Issue 1229933005: Revert "Componentize chrome/browser/rlz" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/google/google_url_tracker_factory.h" 12 #include "chrome/browser/google/google_url_tracker_factory.h"
13 #include "chrome/browser/history/history_service_factory.h" 13 #include "chrome/browser/history/history_service_factory.h"
14 #include "chrome/browser/profiles/incognito_helpers.h" 14 #include "chrome/browser/profiles/incognito_helpers.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/rlz/rlz.h"
16 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" 17 #include "chrome/browser/search_engines/chrome_template_url_service_client.h"
17 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
18 #include "chrome/browser/web_data_service_factory.h" 19 #include "chrome/browser/web_data_service_factory.h"
19 #include "components/keyed_service/content/browser_context_dependency_manager.h" 20 #include "components/keyed_service/content/browser_context_dependency_manager.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 21 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "components/search_engines/default_search_manager.h" 22 #include "components/search_engines/default_search_manager.h"
22 #include "components/search_engines/search_engines_pref_names.h" 23 #include "components/search_engines/search_engines_pref_names.h"
23 #include "components/search_engines/template_url_service.h" 24 #include "components/search_engines/template_url_service.h"
24 25
25 #if defined(ENABLE_RLZ)
26 #include "components/rlz/rlz_tracker.h"
27 #endif
28
29 // static 26 // static
30 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { 27 TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) {
31 return static_cast<TemplateURLService*>( 28 return static_cast<TemplateURLService*>(
32 GetInstance()->GetServiceForBrowserContext(profile, true)); 29 GetInstance()->GetServiceForBrowserContext(profile, true));
33 } 30 }
34 31
35 // static 32 // static
36 TemplateURLServiceFactory* TemplateURLServiceFactory::GetInstance() { 33 TemplateURLServiceFactory* TemplateURLServiceFactory::GetInstance() {
37 return Singleton<TemplateURLServiceFactory>::get(); 34 return Singleton<TemplateURLServiceFactory>::get();
38 } 35 }
39 36
40 // static 37 // static
41 scoped_ptr<KeyedService> TemplateURLServiceFactory::BuildInstanceFor( 38 scoped_ptr<KeyedService> TemplateURLServiceFactory::BuildInstanceFor(
42 content::BrowserContext* context) { 39 content::BrowserContext* context) {
43 base::Closure dsp_change_callback; 40 base::Closure dsp_change_callback;
44 #if defined(ENABLE_RLZ) 41 #if defined(ENABLE_RLZ)
45 dsp_change_callback = base::Bind( 42 dsp_change_callback =
46 base::IgnoreResult(&rlz::RLZTracker::RecordProductEvent), rlz_lib::CHROME, 43 base::Bind(base::IgnoreResult(&RLZTracker::RecordProductEvent),
47 rlz::RLZTracker::ChromeOmnibox(), rlz_lib::SET_TO_GOOGLE); 44 rlz_lib::CHROME,
45 RLZTracker::ChromeOmnibox(),
46 rlz_lib::SET_TO_GOOGLE);
48 #endif 47 #endif
49 Profile* profile = static_cast<Profile*>(context); 48 Profile* profile = static_cast<Profile*>(context);
50 return make_scoped_ptr(new TemplateURLService( 49 return make_scoped_ptr(new TemplateURLService(
51 profile->GetPrefs(), 50 profile->GetPrefs(),
52 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), 51 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)),
53 WebDataServiceFactory::GetKeywordWebDataForProfile( 52 WebDataServiceFactory::GetKeywordWebDataForProfile(
54 profile, ServiceAccessType::EXPLICIT_ACCESS), 53 profile, ServiceAccessType::EXPLICIT_ACCESS),
55 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( 54 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient(
56 HistoryServiceFactory::GetForProfile( 55 HistoryServiceFactory::GetForProfile(
57 profile, ServiceAccessType::EXPLICIT_ACCESS))), 56 profile, ServiceAccessType::EXPLICIT_ACCESS))),
(...skipping 24 matching lines...) Expand all
82 } 81 }
83 82
84 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse( 83 content::BrowserContext* TemplateURLServiceFactory::GetBrowserContextToUse(
85 content::BrowserContext* context) const { 84 content::BrowserContext* context) const {
86 return chrome::GetBrowserContextRedirectedInIncognito(context); 85 return chrome::GetBrowserContextRedirectedInIncognito(context);
87 } 86 }
88 87
89 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const { 88 bool TemplateURLServiceFactory::ServiceIsNULLWhileTesting() const {
90 return true; 89 return true;
91 } 90 }
OLDNEW
« no previous file with comments | « chrome/browser/rlz/rlz_win.cc ('k') | chrome/browser/search_engines/ui_thread_search_terms_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698