Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / content_settings / cookie_settings_factory.h
blob1b4f8e6ff5e97c42a49d70d508a9dd03f97e47d0
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"
12 namespace base {
13 template <typename T>
14 struct DefaultSingletonTraits;
17 namespace content_settings {
18 class CookieSettings;
21 namespace ios {
23 class ChromeBrowserState;
25 // Singleton that owns all CookieSettings and associates them with
26 // ios::ChromeBrowserState.
27 class CookieSettingsFactory : public RefcountedBrowserStateKeyedServiceFactory {
28 public:
29 static scoped_refptr<content_settings::CookieSettings> GetForBrowserState(
30 ios::ChromeBrowserState* browser_state);
31 static CookieSettingsFactory* GetInstance();
33 private:
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);
50 } // namespace ios
52 #endif // IOS_CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_FACTORY_H_