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

Side by Side Diff: ios/chrome/browser/search_engines/template_url_service_factory.h

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 #ifndef IOS_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ 5 #ifndef IOS_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_
6 #define IOS_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ 6 #define IOS_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" 10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
11 11
12 namespace base {
12 template <typename T> 13 template <typename T>
13 struct DefaultSingletonTraits; 14 struct DefaultSingletonTraits;
15 } // namespace base
16
14 class TemplateURLService; 17 class TemplateURLService;
15 18
16 namespace ios { 19 namespace ios {
17 20
18 class ChromeBrowserState; 21 class ChromeBrowserState;
19 22
20 // Singleton that owns all TemplateURLServices and associates them with 23 // Singleton that owns all TemplateURLServices and associates them with
21 // ios::ChromeBrowserState. 24 // ios::ChromeBrowserState.
22 class TemplateURLServiceFactory : public BrowserStateKeyedServiceFactory { 25 class TemplateURLServiceFactory : public BrowserStateKeyedServiceFactory {
23 public: 26 public:
24 static TemplateURLService* GetForBrowserState( 27 static TemplateURLService* GetForBrowserState(
25 ios::ChromeBrowserState* browser_state); 28 ios::ChromeBrowserState* browser_state);
26 static TemplateURLServiceFactory* GetInstance(); 29 static TemplateURLServiceFactory* GetInstance();
27 30
28 // Returns the default factory used to build FaviconService. Can be registered 31 // Returns the default factory used to build FaviconService. Can be registered
29 // with SetTestingFactory to use the FaviconService instance during testing. 32 // with SetTestingFactory to use the FaviconService instance during testing.
30 static TestingFactoryFunction GetDefaultFactory(); 33 static TestingFactoryFunction GetDefaultFactory();
31 34
32 private: 35 private:
33 friend struct DefaultSingletonTraits<TemplateURLServiceFactory>; 36 friend struct base::DefaultSingletonTraits<TemplateURLServiceFactory>;
34 37
35 TemplateURLServiceFactory(); 38 TemplateURLServiceFactory();
36 ~TemplateURLServiceFactory() override; 39 ~TemplateURLServiceFactory() override;
37 40
38 // BrowserStateKeyedServiceFactory implementation. 41 // BrowserStateKeyedServiceFactory implementation.
39 void RegisterBrowserStatePrefs( 42 void RegisterBrowserStatePrefs(
40 user_prefs::PrefRegistrySyncable* registry) override; 43 user_prefs::PrefRegistrySyncable* registry) override;
41 scoped_ptr<KeyedService> BuildServiceInstanceFor( 44 scoped_ptr<KeyedService> BuildServiceInstanceFor(
42 web::BrowserState* context) const override; 45 web::BrowserState* context) const override;
43 web::BrowserState* GetBrowserStateToUse( 46 web::BrowserState* GetBrowserStateToUse(
44 web::BrowserState* context) const override; 47 web::BrowserState* context) const override;
45 bool ServiceIsNULLWhileTesting() const override; 48 bool ServiceIsNULLWhileTesting() const override;
46 49
47 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceFactory); 50 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceFactory);
48 }; 51 };
49 52
50 } // namespace ios 53 } // namespace ios
51 54
52 #endif // IOS_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_ 55 #endif // IOS_CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698