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
3 // found in the LICENSE file.
5 #ifndef IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_
6 #define IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.h"
14 struct DefaultSingletonTraits
;
17 namespace content_settings
{
23 class ChromeBrowserState
;
25 // Singleton that owns all CookieSettings and associates them with
26 // ios::ChromeBrowserState.
27 class CookieSettingsFactory
: public RefcountedBrowserStateKeyedServiceFactory
{
29 static scoped_refptr
<content_settings::CookieSettings
> GetForBrowserState(
30 ios::ChromeBrowserState
* browser_state
);
31 static CookieSettingsFactory
* GetInstance();
34 friend struct base::DefaultSingletonTraits
<CookieSettingsFactory
>;
36 CookieSettingsFactory();
37 ~CookieSettingsFactory() override
;
39 // RefcountedBrowserStateKeyedServiceFactory implementation.
40 void RegisterBrowserStatePrefs(
41 user_prefs::PrefRegistrySyncable
* registry
) override
;
42 web::BrowserState
* GetBrowserStateToUse(
43 web::BrowserState
* context
) const override
;
44 scoped_refptr
<RefcountedKeyedService
> BuildServiceInstanceFor(
45 web::BrowserState
* context
) const override
;
47 DISALLOW_COPY_AND_ASSIGN(CookieSettingsFactory
);
52 #endif // IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_