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_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_ |
6 #define IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_fa
ctory.h" | 10 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_fa
ctory.h" |
11 | 11 |
| 12 namespace base { |
12 template <typename T> | 13 template <typename T> |
13 struct DefaultSingletonTraits; | 14 struct base::DefaultSingletonTraits; |
| 15 } |
14 | 16 |
15 namespace content_settings { | 17 namespace content_settings { |
16 class CookieSettings; | 18 class CookieSettings; |
17 } | 19 } |
18 | 20 |
19 namespace ios { | 21 namespace ios { |
20 | 22 |
21 class ChromeBrowserState; | 23 class ChromeBrowserState; |
22 | 24 |
23 // Singleton that owns all CookieSettings and associates them with | 25 // Singleton that owns all CookieSettings and associates them with |
24 // ios::ChromeBrowserState. | 26 // ios::ChromeBrowserState. |
25 class CookieSettingsFactory : public RefcountedBrowserStateKeyedServiceFactory { | 27 class CookieSettingsFactory : public RefcountedBrowserStateKeyedServiceFactory { |
26 public: | 28 public: |
27 static scoped_refptr<content_settings::CookieSettings> GetForBrowserState( | 29 static scoped_refptr<content_settings::CookieSettings> GetForBrowserState( |
28 ios::ChromeBrowserState* browser_state); | 30 ios::ChromeBrowserState* browser_state); |
29 static CookieSettingsFactory* GetInstance(); | 31 static CookieSettingsFactory* GetInstance(); |
30 | 32 |
31 private: | 33 private: |
32 friend struct DefaultSingletonTraits<CookieSettingsFactory>; | 34 friend struct base::DefaultSingletonTraits<CookieSettingsFactory>; |
33 | 35 |
34 CookieSettingsFactory(); | 36 CookieSettingsFactory(); |
35 ~CookieSettingsFactory() override; | 37 ~CookieSettingsFactory() override; |
36 | 38 |
37 // RefcountedBrowserStateKeyedServiceFactory implementation. | 39 // RefcountedBrowserStateKeyedServiceFactory implementation. |
38 void RegisterBrowserStatePrefs( | 40 void RegisterBrowserStatePrefs( |
39 user_prefs::PrefRegistrySyncable* registry) override; | 41 user_prefs::PrefRegistrySyncable* registry) override; |
40 web::BrowserState* GetBrowserStateToUse( | 42 web::BrowserState* GetBrowserStateToUse( |
41 web::BrowserState* context) const override; | 43 web::BrowserState* context) const override; |
42 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( | 44 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( |
43 web::BrowserState* context) const override; | 45 web::BrowserState* context) const override; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(CookieSettingsFactory); | 47 DISALLOW_COPY_AND_ASSIGN(CookieSettingsFactory); |
46 }; | 48 }; |
47 | 49 |
48 } // namespace ios | 50 } // namespace ios |
49 | 51 |
50 #endif // IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_ | 52 #endif // IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_ |
OLD | NEW |