Chromium Code Reviews| 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_FAVICON_IOS_CHROME_LARGE_ICON_SERVICE_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_FAVICON_IOS_CHROME_LARGE_ICON_SERVICE_FACTORY_H_ |
| 6 #define IOS_CHROME_BROWSER_FAVICON_IOS_CHROME_LARGE_ICON_SERVICE_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_FAVICON_IOS_CHROME_LARGE_ICON_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 class KeyedService; | 12 class KeyedService; |
|
sdefresne
2015/11/21 01:52:03
nit: this is not required as the type is already d
| |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 template <typename T> | 15 template <typename T> |
| 16 struct DefaultSingletonTraits; | 16 struct DefaultSingletonTraits; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace favicon { | 19 namespace favicon { |
| 20 class LargeIconService; | 20 class LargeIconService; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 namespace ios { | 23 namespace ios { |
| 24 class ChromeBrowserState; | 24 class ChromeBrowserState; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Singleton that owns all LargeIconService and associates them with | 27 // Singleton that owns all LargeIconService and associates them with |
| 28 // ChromeBrowserState. | 28 // ChromeBrowserState. |
| 29 class IOSChromeLargeIconServiceFactory | 29 class IOSChromeLargeIconServiceFactory |
| 30 : public BrowserStateKeyedServiceFactory { | 30 : public BrowserStateKeyedServiceFactory { |
| 31 public: | 31 public: |
| 32 static favicon::LargeIconService* GetForBrowserState( | 32 static favicon::LargeIconService* GetForBrowserState( |
| 33 ios::ChromeBrowserState* browser_state); | 33 ios::ChromeBrowserState* browser_state); |
| 34 | 34 |
| 35 static IOSChromeLargeIconServiceFactory* GetInstance(); | 35 static IOSChromeLargeIconServiceFactory* GetInstance(); |
| 36 | 36 |
| 37 // Returns the default factory used to build IOSChromeLargeIconService. Can be | |
| 38 // registered with SetTestingFactory to use the IOSChromeLargeIconService | |
| 39 // instance during testing. | |
| 40 static TestingFactoryFunction GetDefaultFactory(); | |
| 41 | |
| 37 private: | 42 private: |
| 38 friend struct base::DefaultSingletonTraits<IOSChromeLargeIconServiceFactory>; | 43 friend struct base::DefaultSingletonTraits<IOSChromeLargeIconServiceFactory>; |
| 39 | 44 |
| 40 IOSChromeLargeIconServiceFactory(); | 45 IOSChromeLargeIconServiceFactory(); |
| 41 ~IOSChromeLargeIconServiceFactory() override; | 46 ~IOSChromeLargeIconServiceFactory() override; |
| 42 | 47 |
| 43 // BrowserStateKeyedServiceFactory implementation. | 48 // BrowserStateKeyedServiceFactory implementation. |
| 44 scoped_ptr<KeyedService> BuildServiceInstanceFor( | 49 scoped_ptr<KeyedService> BuildServiceInstanceFor( |
| 45 web::BrowserState* context) const override; | 50 web::BrowserState* context) const override; |
| 46 web::BrowserState* GetBrowserStateToUse( | 51 web::BrowserState* GetBrowserStateToUse( |
| 47 web::BrowserState* context) const override; | 52 web::BrowserState* context) const override; |
| 48 | 53 |
|
sdefresne
2015/11/21 01:52:03
The class does not override ServiceIsNULLWhileTest
| |
| 49 DISALLOW_COPY_AND_ASSIGN(IOSChromeLargeIconServiceFactory); | 54 DISALLOW_COPY_AND_ASSIGN(IOSChromeLargeIconServiceFactory); |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 #endif // IOS_CHROME_BROWSER_FAVICON_IOS_CHROME_LARGE_ICON_SERVICE_FACTORY_H_ | 57 #endif // IOS_CHROME_BROWSER_FAVICON_IOS_CHROME_LARGE_ICON_SERVICE_FACTORY_H_ |
| OLD | NEW |