| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/autocomplete/shortcuts_backend.h" | 8 #include "chrome/browser/autocomplete/shortcuts_backend.h" |
| 9 #include "chrome/browser/history/history_service_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 | 12 |
| 12 // static | 13 // static |
| 13 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfile( | 14 scoped_refptr<ShortcutsBackend> ShortcutsBackendFactory::GetForProfile( |
| 14 Profile* profile) { | 15 Profile* profile) { |
| 15 return static_cast<ShortcutsBackend*>( | 16 return static_cast<ShortcutsBackend*>( |
| 16 GetInstance()->GetServiceForBrowserContext(profile, true).get()); | 17 GetInstance()->GetServiceForBrowserContext(profile, true).get()); |
| 17 } | 18 } |
| 18 | 19 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 47 new ShortcutsBackend(static_cast<Profile*>(profile), true)); | 48 new ShortcutsBackend(static_cast<Profile*>(profile), true)); |
| 48 if (backend->Init()) | 49 if (backend->Init()) |
| 49 return backend; | 50 return backend; |
| 50 return NULL; | 51 return NULL; |
| 51 } | 52 } |
| 52 | 53 |
| 53 ShortcutsBackendFactory::ShortcutsBackendFactory() | 54 ShortcutsBackendFactory::ShortcutsBackendFactory() |
| 54 : RefcountedBrowserContextKeyedServiceFactory( | 55 : RefcountedBrowserContextKeyedServiceFactory( |
| 55 "ShortcutsBackend", | 56 "ShortcutsBackend", |
| 56 BrowserContextDependencyManager::GetInstance()) { | 57 BrowserContextDependencyManager::GetInstance()) { |
| 58 DependsOn(HistoryServiceFactory::GetInstance()); |
| 57 } | 59 } |
| 58 | 60 |
| 59 ShortcutsBackendFactory::~ShortcutsBackendFactory() {} | 61 ShortcutsBackendFactory::~ShortcutsBackendFactory() {} |
| 60 | 62 |
| 61 scoped_refptr<RefcountedKeyedService> | 63 scoped_refptr<RefcountedKeyedService> |
| 62 ShortcutsBackendFactory::BuildServiceInstanceFor( | 64 ShortcutsBackendFactory::BuildServiceInstanceFor( |
| 63 content::BrowserContext* profile) const { | 65 content::BrowserContext* profile) const { |
| 64 scoped_refptr<ShortcutsBackend> backend( | 66 scoped_refptr<ShortcutsBackend> backend( |
| 65 new ShortcutsBackend(static_cast<Profile*>(profile), false)); | 67 new ShortcutsBackend(static_cast<Profile*>(profile), false)); |
| 66 if (backend->Init()) | 68 if (backend->Init()) |
| 67 return backend; | 69 return backend; |
| 68 return NULL; | 70 return NULL; |
| 69 } | 71 } |
| 70 | 72 |
| 71 bool ShortcutsBackendFactory::ServiceIsNULLWhileTesting() const { | 73 bool ShortcutsBackendFactory::ServiceIsNULLWhileTesting() const { |
| 72 return true; | 74 return true; |
| 73 } | 75 } |
| OLD | NEW |