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_FAVICON_SERVICE_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_ |
6 #define IOS_CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_FAVICON_FAVICON_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 favicon { | 19 namespace favicon { |
17 class FaviconService; | 20 class FaviconService; |
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 FaviconServices and associates them with | 27 // Singleton that owns all FaviconServices and associates them with |
25 // ios::ChromeBrowserState. | 28 // ios::ChromeBrowserState. |
26 class FaviconServiceFactory : public BrowserStateKeyedServiceFactory { | 29 class FaviconServiceFactory : public BrowserStateKeyedServiceFactory { |
27 public: | 30 public: |
28 static favicon::FaviconService* GetForBrowserState( | 31 static favicon::FaviconService* GetForBrowserState( |
29 ios::ChromeBrowserState* browser_state, | 32 ios::ChromeBrowserState* browser_state, |
30 ServiceAccessType access_type); | 33 ServiceAccessType access_type); |
31 static FaviconServiceFactory* GetInstance(); | 34 static FaviconServiceFactory* GetInstance(); |
32 | 35 |
33 private: | 36 private: |
34 friend struct DefaultSingletonTraits<FaviconServiceFactory>; | 37 friend struct base::DefaultSingletonTraits<FaviconServiceFactory>; |
35 | 38 |
36 FaviconServiceFactory(); | 39 FaviconServiceFactory(); |
37 ~FaviconServiceFactory() override; | 40 ~FaviconServiceFactory() override; |
38 | 41 |
39 // BrowserStateKeyedServiceFactory implementation. | 42 // BrowserStateKeyedServiceFactory implementation. |
40 scoped_ptr<KeyedService> BuildServiceInstanceFor( | 43 scoped_ptr<KeyedService> BuildServiceInstanceFor( |
41 web::BrowserState* context) const override; | 44 web::BrowserState* context) const override; |
42 bool ServiceIsNULLWhileTesting() const override; | 45 bool ServiceIsNULLWhileTesting() const override; |
43 | 46 |
44 DISALLOW_COPY_AND_ASSIGN(FaviconServiceFactory); | 47 DISALLOW_COPY_AND_ASSIGN(FaviconServiceFactory); |
45 }; | 48 }; |
46 | 49 |
47 } // namespace ios | 50 } // namespace ios |
48 | 51 |
49 #endif // IOS_CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_ | 52 #endif // IOS_CHROME_BROWSER_FAVICON_FAVICON_SERVICE_FACTORY_H_ |
OLD | NEW |