OLD | NEW |
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/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
11 #include "chrome/browser/profiles/incognito_helpers.h" | 11 #include "chrome/browser/profiles/incognito_helpers.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/keyed_service/core/service_access_type.h" | 15 #include "components/keyed_service/core/service_access_type.h" |
16 #include "components/omnibox/browser/in_memory_url_index.h" | 16 #include "components/omnibox/browser/in_memory_url_index.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
19 | 19 |
20 // static | 20 // static |
21 InMemoryURLIndex* InMemoryURLIndexFactory::GetForProfile(Profile* profile) { | 21 InMemoryURLIndex* InMemoryURLIndexFactory::GetForProfile(Profile* profile) { |
22 return static_cast<InMemoryURLIndex*>( | 22 return static_cast<InMemoryURLIndex*>( |
23 GetInstance()->GetServiceForBrowserContext(profile, true)); | 23 GetInstance()->GetServiceForBrowserContext(profile, true)); |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 InMemoryURLIndexFactory* InMemoryURLIndexFactory::GetInstance() { | 27 InMemoryURLIndexFactory* InMemoryURLIndexFactory::GetInstance() { |
28 return Singleton<InMemoryURLIndexFactory>::get(); | 28 return base::Singleton<InMemoryURLIndexFactory>::get(); |
29 } | 29 } |
30 | 30 |
31 InMemoryURLIndexFactory::InMemoryURLIndexFactory() | 31 InMemoryURLIndexFactory::InMemoryURLIndexFactory() |
32 : BrowserContextKeyedServiceFactory( | 32 : BrowserContextKeyedServiceFactory( |
33 "InMemoryURLIndex", | 33 "InMemoryURLIndex", |
34 BrowserContextDependencyManager::GetInstance()) { | 34 BrowserContextDependencyManager::GetInstance()) { |
35 DependsOn(BookmarkModelFactory::GetInstance()); | 35 DependsOn(BookmarkModelFactory::GetInstance()); |
36 DependsOn(HistoryServiceFactory::GetInstance()); | 36 DependsOn(HistoryServiceFactory::GetInstance()); |
37 } | 37 } |
38 | 38 |
(...skipping 18 matching lines...) Expand all Loading... |
57 } | 57 } |
58 | 58 |
59 content::BrowserContext* InMemoryURLIndexFactory::GetBrowserContextToUse( | 59 content::BrowserContext* InMemoryURLIndexFactory::GetBrowserContextToUse( |
60 content::BrowserContext* context) const { | 60 content::BrowserContext* context) const { |
61 return chrome::GetBrowserContextRedirectedInIncognito(context); | 61 return chrome::GetBrowserContextRedirectedInIncognito(context); |
62 } | 62 } |
63 | 63 |
64 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const { | 64 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const { |
65 return true; | 65 return true; |
66 } | 66 } |
OLD | NEW |