OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // thread and read on any thread. One instance per profile. | 30 // thread and read on any thread. One instance per profile. |
31 | 31 |
32 class CookieSettings | 32 class CookieSettings |
33 : public content::NotificationObserver, | 33 : public content::NotificationObserver, |
34 public RefcountedProfileKeyedService { | 34 public RefcountedProfileKeyedService { |
35 public: | 35 public: |
36 CookieSettings( | 36 CookieSettings( |
37 HostContentSettingsMap* host_content_settings_map, | 37 HostContentSettingsMap* host_content_settings_map, |
38 PrefService* prefs); | 38 PrefService* prefs); |
39 | 39 |
40 virtual ~CookieSettings(); | |
41 | |
42 // Returns the default content setting (CONTENT_SETTING_ALLOW, | 40 // Returns the default content setting (CONTENT_SETTING_ALLOW, |
43 // CONTENT_SETTING_BLOCK, or CONTENT_SETTING_SESSION_ONLY) for cookies. If | 41 // CONTENT_SETTING_BLOCK, or CONTENT_SETTING_SESSION_ONLY) for cookies. If |
44 // |provider_id| is not NULL, the id of the provider which provided the | 42 // |provider_id| is not NULL, the id of the provider which provided the |
45 // default setting is assigned to it. | 43 // default setting is assigned to it. |
46 // | 44 // |
47 // This may be called on any thread. | 45 // This may be called on any thread. |
48 ContentSetting GetDefaultCookieSetting(std::string* provider_id) const; | 46 ContentSetting GetDefaultCookieSetting(std::string* provider_id) const; |
49 | 47 |
50 // Returns true if the page identified by (|url|, |first_party_url|) is | 48 // Returns true if the page identified by (|url|, |first_party_url|) is |
51 // allowed to read cookies. | 49 // allowed to read cookies. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 virtual ~Factory(); | 127 virtual ~Factory(); |
130 | 128 |
131 // |ProfileKeyedBaseFactory| methods: | 129 // |ProfileKeyedBaseFactory| methods: |
132 virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; | 130 virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; |
133 virtual bool ServiceRedirectedInIncognito() OVERRIDE; | 131 virtual bool ServiceRedirectedInIncognito() OVERRIDE; |
134 virtual scoped_refptr<RefcountedProfileKeyedService> | 132 virtual scoped_refptr<RefcountedProfileKeyedService> |
135 BuildServiceInstanceFor(Profile* profile) const OVERRIDE; | 133 BuildServiceInstanceFor(Profile* profile) const OVERRIDE; |
136 }; | 134 }; |
137 | 135 |
138 private: | 136 private: |
| 137 virtual ~CookieSettings(); |
| 138 |
139 // Returns true if the "block third party cookies" preference is set. | 139 // Returns true if the "block third party cookies" preference is set. |
140 // | 140 // |
141 // This method may be called on any thread. | 141 // This method may be called on any thread. |
142 bool ShouldBlockThirdPartyCookies() const; | 142 bool ShouldBlockThirdPartyCookies() const; |
143 | 143 |
144 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 144 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
145 PrefChangeRegistrar pref_change_registrar_; | 145 PrefChangeRegistrar pref_change_registrar_; |
146 | 146 |
147 // Used around accesses to |block_third_party_cookies_| to guarantee thread | 147 // Used around accesses to |block_third_party_cookies_| to guarantee thread |
148 // safety. | 148 // safety. |
149 mutable base::Lock lock_; | 149 mutable base::Lock lock_; |
150 | 150 |
151 bool block_third_party_cookies_; | 151 bool block_third_party_cookies_; |
152 }; | 152 }; |
153 | 153 |
154 #endif // CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_H_ | 154 #endif // CHROME_BROWSER_CONTENT_SETTINGS_COOKIE_SETTINGS_H_ |
OLD | NEW |