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

Side by Side Diff: chrome/browser/autocomplete/in_memory_url_index_factory.cc

Issue 976423002: Remove ScoreHistoryMatch::Builder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cpplint
Patch Set: Rebase Created 5 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/autocomplete/in_memory_url_index_factory.h" 5 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/autocomplete/in_memory_url_index.h" 9 #include "chrome/browser/autocomplete/in_memory_url_index.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
10 #include "chrome/browser/history/history_service_factory.h" 11 #include "chrome/browser/history/history_service_factory.h"
11 #include "chrome/browser/profiles/incognito_helpers.h" 12 #include "chrome/browser/profiles/incognito_helpers.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" 15 #include "components/keyed_service/content/browser_context_dependency_manager.h"
15 #include "components/keyed_service/core/service_access_type.h" 16 #include "components/keyed_service/core/service_access_type.h"
16 17
17 // static 18 // static
18 InMemoryURLIndex* InMemoryURLIndexFactory::GetForProfile(Profile* profile) { 19 InMemoryURLIndex* InMemoryURLIndexFactory::GetForProfile(Profile* profile) {
19 return static_cast<InMemoryURLIndex*>( 20 return static_cast<InMemoryURLIndex*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true)); 21 GetInstance()->GetServiceForBrowserContext(profile, true));
21 } 22 }
22 23
23 // static 24 // static
24 InMemoryURLIndexFactory* InMemoryURLIndexFactory::GetInstance() { 25 InMemoryURLIndexFactory* InMemoryURLIndexFactory::GetInstance() {
25 return Singleton<InMemoryURLIndexFactory>::get(); 26 return Singleton<InMemoryURLIndexFactory>::get();
26 } 27 }
27 28
28 InMemoryURLIndexFactory::InMemoryURLIndexFactory() 29 InMemoryURLIndexFactory::InMemoryURLIndexFactory()
29 : BrowserContextKeyedServiceFactory( 30 : BrowserContextKeyedServiceFactory(
30 "InMemoryURLIndex", 31 "InMemoryURLIndex",
31 BrowserContextDependencyManager::GetInstance()) { 32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(BookmarkModelFactory::GetInstance());
32 DependsOn(HistoryServiceFactory::GetInstance()); 34 DependsOn(HistoryServiceFactory::GetInstance());
33 } 35 }
34 36
35 InMemoryURLIndexFactory::~InMemoryURLIndexFactory() { 37 InMemoryURLIndexFactory::~InMemoryURLIndexFactory() {
36 } 38 }
37 39
38 KeyedService* InMemoryURLIndexFactory::BuildServiceInstanceFor( 40 KeyedService* InMemoryURLIndexFactory::BuildServiceInstanceFor(
39 content::BrowserContext* context) const { 41 content::BrowserContext* context) const {
40 // Do not force creation of the HistoryService if saving history is disabled. 42 // Do not force creation of the HistoryService if saving history is disabled.
41 Profile* profile = Profile::FromBrowserContext(context); 43 Profile* profile = Profile::FromBrowserContext(context);
42 InMemoryURLIndex* in_memory_url_index = new InMemoryURLIndex( 44 InMemoryURLIndex* in_memory_url_index = new InMemoryURLIndex(
45 BookmarkModelFactory::GetForProfile(profile),
43 HistoryServiceFactory::GetForProfile(profile, 46 HistoryServiceFactory::GetForProfile(profile,
44 ServiceAccessType::IMPLICIT_ACCESS), 47 ServiceAccessType::IMPLICIT_ACCESS),
45 profile->GetPath(), 48 profile->GetPath(),
46 profile->GetPrefs()->GetString(prefs::kAcceptLanguages)); 49 profile->GetPrefs()->GetString(prefs::kAcceptLanguages));
47 in_memory_url_index->Init(); 50 in_memory_url_index->Init();
48 return in_memory_url_index; 51 return in_memory_url_index;
49 } 52 }
50 53
51 content::BrowserContext* InMemoryURLIndexFactory::GetBrowserContextToUse( 54 content::BrowserContext* InMemoryURLIndexFactory::GetBrowserContextToUse(
52 content::BrowserContext* context) const { 55 content::BrowserContext* context) const {
53 return chrome::GetBrowserContextRedirectedInIncognito(context); 56 return chrome::GetBrowserContextRedirectedInIncognito(context);
54 } 57 }
55 58
56 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const { 59 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const {
57 return true; 60 return true;
58 } 61 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/in_memory_url_index.cc ('k') | chrome/browser/autocomplete/in_memory_url_index_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698