OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SUGGESTIONS_SUGGESTIONS_SERVICE_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_SUGGESTIONS_SUGGESTIONS_SERVICE_FACTORY_H_ |
6 #define IOS_CHROME_BROWSER_SUGGESTIONS_SUGGESTIONS_SERVICE_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_SUGGESTIONS_SUGGESTIONS_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 |
14 | 16 |
15 namespace ios { | 17 namespace ios { |
16 class ChromeBrowserState; | 18 class ChromeBrowserState; |
17 } | 19 } |
18 | 20 |
19 namespace suggestions { | 21 namespace suggestions { |
20 | 22 |
21 class SuggestionsService; | 23 class SuggestionsService; |
22 | 24 |
23 // Singleton that owns all SuggestionsServices and associates them with | 25 // Singleton that owns all SuggestionsServices and associates them with |
24 // web::BrowserState. | 26 // web::BrowserState. |
25 class SuggestionsServiceFactory : public BrowserStateKeyedServiceFactory { | 27 class SuggestionsServiceFactory : public BrowserStateKeyedServiceFactory { |
26 public: | 28 public: |
27 static SuggestionsServiceFactory* GetInstance(); | 29 static SuggestionsServiceFactory* GetInstance(); |
28 | 30 |
29 // Returns the SuggestionsService for |browser_state|. | 31 // Returns the SuggestionsService for |browser_state|. |
30 static SuggestionsService* GetForBrowserState( | 32 static SuggestionsService* GetForBrowserState( |
31 ios::ChromeBrowserState* browser_state); | 33 ios::ChromeBrowserState* browser_state); |
32 | 34 |
33 private: | 35 private: |
34 friend struct DefaultSingletonTraits<SuggestionsServiceFactory>; | 36 friend struct base::DefaultSingletonTraits<SuggestionsServiceFactory>; |
35 | 37 |
36 SuggestionsServiceFactory(); | 38 SuggestionsServiceFactory(); |
37 ~SuggestionsServiceFactory() override; | 39 ~SuggestionsServiceFactory() override; |
38 | 40 |
39 // BrowserStateKeyedServiceFactory implementation. | 41 // BrowserStateKeyedServiceFactory implementation. |
40 scoped_ptr<KeyedService> BuildServiceInstanceFor( | 42 scoped_ptr<KeyedService> BuildServiceInstanceFor( |
41 web::BrowserState* context) const override; | 43 web::BrowserState* context) const override; |
42 void RegisterBrowserStatePrefs( | 44 void RegisterBrowserStatePrefs( |
43 user_prefs::PrefRegistrySyncable* registry) override; | 45 user_prefs::PrefRegistrySyncable* registry) override; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(SuggestionsServiceFactory); | 47 DISALLOW_COPY_AND_ASSIGN(SuggestionsServiceFactory); |
46 }; | 48 }; |
47 | 49 |
48 } // namespace suggestions | 50 } // namespace suggestions |
49 | 51 |
50 #endif // IOS_CHROME_BROWSER_SUGGESTIONS_SUGGESTIONS_SERVICE_FACTORY_H_ | 52 #endif // IOS_CHROME_BROWSER_SUGGESTIONS_SUGGESTIONS_SERVICE_FACTORY_H_ |
OLD | NEW |