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