OLD | NEW |
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/autocomplete/shortcuts_backend_factory.h" | 5 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/autocomplete/shortcuts_extensions_manager.h" | |
11 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/search_engines/template_url_service_factory.h" | 12 #include "chrome/browser/search_engines/template_url_service_factory.h" |
14 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 13 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
15 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
16 #include "components/omnibox/browser/shortcuts_backend.h" | 15 #include "components/omnibox/browser/shortcuts_backend.h" |
17 #include "components/omnibox/browser/shortcuts_constants.h" | 16 #include "components/omnibox/browser/shortcuts_constants.h" |
18 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
19 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
20 #include "extensions/features/features.h" | 19 #include "extensions/features/features.h" |
21 | 20 |
| 21 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 22 #include "chrome/browser/autocomplete/shortcuts_extensions_manager.h" |
| 23 |
22 namespace { | 24 namespace { |
23 #if BUILDFLAG(ENABLE_EXTENSIONS) | |
24 const char kShortcutsExtensionsManagerKey[] = "ShortcutsExtensionsManager"; | 25 const char kShortcutsExtensionsManagerKey[] = "ShortcutsExtensionsManager"; |
| 26 } |
25 #endif | 27 #endif |
26 } | |
27 | 28 |
28 // static | 29 // static |
29 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfile( | 30 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfile( |
30 Profile* profile) { | 31 Profile* profile) { |
31 return static_cast<ShortcutsBackend*>( | 32 return static_cast<ShortcutsBackend*>( |
32 GetInstance()->GetServiceForBrowserContext(profile, true).get()); | 33 GetInstance()->GetServiceForBrowserContext(profile, true).get()); |
33 } | 34 } |
34 | 35 |
35 // static | 36 // static |
36 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfileIfExists( | 37 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfileIfExists( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 content::BrowserThread::GetTaskRunnerForThread( | 100 content::BrowserThread::GetTaskRunnerForThread( |
100 content::BrowserThread::DB), | 101 content::BrowserThread::DB), |
101 profile->GetPath().Append(kShortcutsDatabaseName), suppress_db)); | 102 profile->GetPath().Append(kShortcutsDatabaseName), suppress_db)); |
102 #if BUILDFLAG(ENABLE_EXTENSIONS) | 103 #if BUILDFLAG(ENABLE_EXTENSIONS) |
103 ShortcutsExtensionsManager* extensions_manager = | 104 ShortcutsExtensionsManager* extensions_manager = |
104 new ShortcutsExtensionsManager(profile); | 105 new ShortcutsExtensionsManager(profile); |
105 profile->SetUserData(kShortcutsExtensionsManagerKey, extensions_manager); | 106 profile->SetUserData(kShortcutsExtensionsManagerKey, extensions_manager); |
106 #endif | 107 #endif |
107 return backend->Init() ? backend : nullptr; | 108 return backend->Init() ? backend : nullptr; |
108 } | 109 } |
OLD | NEW |