OLD | NEW |
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_HISTORY_HISTORY_SERVICE_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_ |
6 #define IOS_CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_HISTORY_HISTORY_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 enum class ServiceAccessType; | 17 enum class ServiceAccessType; |
15 | 18 |
16 namespace history { | 19 namespace history { |
17 class HistoryService; | 20 class HistoryService; |
18 } | 21 } |
19 | 22 |
20 namespace ios { | 23 namespace ios { |
21 | 24 |
22 class ChromeBrowserState; | 25 class ChromeBrowserState; |
23 | 26 |
24 // Singleton that owns all HistoryServices and associates them with | 27 // Singleton that owns all HistoryServices and associates them with |
25 // ios::ChromeBrowserState. | 28 // ios::ChromeBrowserState. |
26 class HistoryServiceFactory : public BrowserStateKeyedServiceFactory { | 29 class HistoryServiceFactory : public BrowserStateKeyedServiceFactory { |
27 public: | 30 public: |
28 static history::HistoryService* GetForBrowserState( | 31 static history::HistoryService* GetForBrowserState( |
29 ios::ChromeBrowserState* browser_state, | 32 ios::ChromeBrowserState* browser_state, |
30 ServiceAccessType access_type); | 33 ServiceAccessType access_type); |
31 static history::HistoryService* GetForBrowserStateIfExists( | 34 static history::HistoryService* GetForBrowserStateIfExists( |
32 ios::ChromeBrowserState* browser_state, | 35 ios::ChromeBrowserState* browser_state, |
33 ServiceAccessType access_type); | 36 ServiceAccessType access_type); |
34 static HistoryServiceFactory* GetInstance(); | 37 static HistoryServiceFactory* GetInstance(); |
35 | 38 |
36 private: | 39 private: |
37 friend struct DefaultSingletonTraits<HistoryServiceFactory>; | 40 friend struct base::DefaultSingletonTraits<HistoryServiceFactory>; |
38 | 41 |
39 HistoryServiceFactory(); | 42 HistoryServiceFactory(); |
40 ~HistoryServiceFactory() override; | 43 ~HistoryServiceFactory() override; |
41 | 44 |
42 // BrowserStateKeyedServiceFactory implementation. | 45 // BrowserStateKeyedServiceFactory implementation. |
43 scoped_ptr<KeyedService> BuildServiceInstanceFor( | 46 scoped_ptr<KeyedService> BuildServiceInstanceFor( |
44 web::BrowserState* context) const override; | 47 web::BrowserState* context) const override; |
45 web::BrowserState* GetBrowserStateToUse( | 48 web::BrowserState* GetBrowserStateToUse( |
46 web::BrowserState* context) const override; | 49 web::BrowserState* context) const override; |
47 bool ServiceIsNULLWhileTesting() const override; | 50 bool ServiceIsNULLWhileTesting() const override; |
48 | 51 |
49 DISALLOW_COPY_AND_ASSIGN(HistoryServiceFactory); | 52 DISALLOW_COPY_AND_ASSIGN(HistoryServiceFactory); |
50 }; | 53 }; |
51 | 54 |
52 } // namespace ios | 55 } // namespace ios |
53 | 56 |
54 #endif // IOS_CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_ | 57 #endif // IOS_CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_ |
OLD | NEW |