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"
13 struct DefaultSingletonTraits
;
15 namespace content_settings
{
21 class ChromeBrowserState
;
23 // Singleton that owns all CookieSettings and associates them with
24 // ios::ChromeBrowserState.
25 class CookieSettingsFactory
: public RefcountedBrowserStateKeyedServiceFactory
{
27 static scoped_refptr
<content_settings::CookieSettings
> GetForBrowserState(
28 ios::ChromeBrowserState
* browser_state
);
29 static CookieSettingsFactory
* GetInstance();
32 friend struct DefaultSingletonTraits
<CookieSettingsFactory
>;
34 CookieSettingsFactory();
35 ~CookieSettingsFactory() override
;
37 // RefcountedBrowserStateKeyedServiceFactory implementation.
38 void RegisterBrowserStatePrefs(
39 user_prefs::PrefRegistrySyncable
* registry
) override
;
40 web::BrowserState
* GetBrowserStateToUse(
41 web::BrowserState
* context
) const override
;
42 scoped_refptr
<RefcountedKeyedService
> BuildServiceInstanceFor(
43 web::BrowserState
* context
) const override
;
45 DISALLOW_COPY_AND_ASSIGN(CookieSettingsFactory
);
50 #endif // IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_