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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/autocomplete/shortcuts_extensions_manager.h" | 9 #include "chrome/browser/autocomplete/shortcuts_extensions_manager.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // static | 32 // static |
33 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfileIfExists( | 33 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfileIfExists( |
34 Profile* profile) { | 34 Profile* profile) { |
35 return static_cast<ShortcutsBackend*>( | 35 return static_cast<ShortcutsBackend*>( |
36 GetInstance()->GetServiceForBrowserContext(profile, false).get()); | 36 GetInstance()->GetServiceForBrowserContext(profile, false).get()); |
37 } | 37 } |
38 | 38 |
39 // static | 39 // static |
40 ShortcutsBackendFactory* ShortcutsBackendFactory::GetInstance() { | 40 ShortcutsBackendFactory* ShortcutsBackendFactory::GetInstance() { |
41 return Singleton<ShortcutsBackendFactory>::get(); | 41 return base::Singleton<ShortcutsBackendFactory>::get(); |
42 } | 42 } |
43 | 43 |
44 // static | 44 // static |
45 scoped_refptr<RefcountedKeyedService> | 45 scoped_refptr<RefcountedKeyedService> |
46 ShortcutsBackendFactory::BuildProfileForTesting( | 46 ShortcutsBackendFactory::BuildProfileForTesting( |
47 content::BrowserContext* profile) { | 47 content::BrowserContext* profile) { |
48 return CreateShortcutsBackend(Profile::FromBrowserContext(profile), false); | 48 return CreateShortcutsBackend(Profile::FromBrowserContext(profile), false); |
49 } | 49 } |
50 | 50 |
51 // static | 51 // static |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 content::BrowserThread::GetMessageLoopProxyForThread( | 96 content::BrowserThread::GetMessageLoopProxyForThread( |
97 content::BrowserThread::DB), | 97 content::BrowserThread::DB), |
98 profile->GetPath().Append(kShortcutsDatabaseName), suppress_db)); | 98 profile->GetPath().Append(kShortcutsDatabaseName), suppress_db)); |
99 #if defined(ENABLE_EXTENSIONS) | 99 #if defined(ENABLE_EXTENSIONS) |
100 ShortcutsExtensionsManager* extensions_manager = | 100 ShortcutsExtensionsManager* extensions_manager = |
101 new ShortcutsExtensionsManager(profile); | 101 new ShortcutsExtensionsManager(profile); |
102 profile->SetUserData(kShortcutsExtensionsManagerKey, extensions_manager); | 102 profile->SetUserData(kShortcutsExtensionsManagerKey, extensions_manager); |
103 #endif | 103 #endif |
104 return backend->Init() ? backend : nullptr; | 104 return backend->Init() ? backend : nullptr; |
105 } | 105 } |
OLD | NEW |