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

Side by Side Diff: ios/chrome/browser/autocomplete/shortcuts_backend_factory.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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 "ios/chrome/browser/autocomplete/shortcuts_backend_factory.h" 5 #include "ios/chrome/browser/autocomplete/shortcuts_backend_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 "components/keyed_service/core/service_access_type.h" 9 #include "components/keyed_service/core/service_access_type.h"
10 #include "components/keyed_service/ios/browser_state_dependency_manager.h" 10 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // static 47 // static
48 scoped_refptr<ShortcutsBackend> 48 scoped_refptr<ShortcutsBackend>
49 ShortcutsBackendFactory::GetForBrowserStateIfExists( 49 ShortcutsBackendFactory::GetForBrowserStateIfExists(
50 ios::ChromeBrowserState* browser_state) { 50 ios::ChromeBrowserState* browser_state) {
51 return make_scoped_refptr(static_cast<ShortcutsBackend*>( 51 return make_scoped_refptr(static_cast<ShortcutsBackend*>(
52 GetInstance()->GetServiceForBrowserState(browser_state, false).get())); 52 GetInstance()->GetServiceForBrowserState(browser_state, false).get()));
53 } 53 }
54 54
55 // static 55 // static
56 ShortcutsBackendFactory* ShortcutsBackendFactory::GetInstance() { 56 ShortcutsBackendFactory* ShortcutsBackendFactory::GetInstance() {
57 return Singleton<ShortcutsBackendFactory>::get(); 57 return base::Singleton<ShortcutsBackendFactory>::get();
58 } 58 }
59 59
60 ShortcutsBackendFactory::ShortcutsBackendFactory() 60 ShortcutsBackendFactory::ShortcutsBackendFactory()
61 : RefcountedBrowserStateKeyedServiceFactory( 61 : RefcountedBrowserStateKeyedServiceFactory(
62 "ShortcutsBackend", 62 "ShortcutsBackend",
63 BrowserStateDependencyManager::GetInstance()) { 63 BrowserStateDependencyManager::GetInstance()) {
64 DependsOn(ios::HistoryServiceFactory::GetInstance()); 64 DependsOn(ios::HistoryServiceFactory::GetInstance());
65 DependsOn(ios::TemplateURLServiceFactory::GetInstance()); 65 DependsOn(ios::TemplateURLServiceFactory::GetInstance());
66 } 66 }
67 67
68 ShortcutsBackendFactory::~ShortcutsBackendFactory() {} 68 ShortcutsBackendFactory::~ShortcutsBackendFactory() {}
69 69
70 scoped_refptr<RefcountedKeyedService> 70 scoped_refptr<RefcountedKeyedService>
71 ShortcutsBackendFactory::BuildServiceInstanceFor( 71 ShortcutsBackendFactory::BuildServiceInstanceFor(
72 web::BrowserState* context) const { 72 web::BrowserState* context) const {
73 ios::ChromeBrowserState* browser_state = 73 ios::ChromeBrowserState* browser_state =
74 ios::ChromeBrowserState::FromBrowserState(context); 74 ios::ChromeBrowserState::FromBrowserState(context);
75 return CreateShortcutsBackend(browser_state, false /* suppress_db */); 75 return CreateShortcutsBackend(browser_state, false /* suppress_db */);
76 } 76 }
77 77
78 bool ShortcutsBackendFactory::ServiceIsNULLWhileTesting() const { 78 bool ShortcutsBackendFactory::ServiceIsNULLWhileTesting() const {
79 return true; 79 return true;
80 } 80 }
81 81
82 } // namespace ios 82 } // namespace ios
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698