OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Maps hostnames to custom content settings. Written on the UI thread and read | 5 // Maps hostnames to custom content settings. Written on the UI thread and read |
6 // on any thread. One instance per profile. | 6 // on any thread. One instance per profile. |
7 | 7 |
8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // certain internal schemes are whitelisted. For ContentSettingsTypes that | 58 // certain internal schemes are whitelisted. For ContentSettingsTypes that |
59 // require an resource identifier to be specified, the |resource_identifier| | 59 // require an resource identifier to be specified, the |resource_identifier| |
60 // must be non-empty. | 60 // must be non-empty. |
61 // | 61 // |
62 // This may be called on any thread. | 62 // This may be called on any thread. |
63 ContentSetting GetContentSetting( | 63 ContentSetting GetContentSetting( |
64 const GURL& url, | 64 const GURL& url, |
65 ContentSettingsType content_type, | 65 ContentSettingsType content_type, |
66 const std::string& resource_identifier) const; | 66 const std::string& resource_identifier) const; |
67 | 67 |
| 68 // Gets the content setting for cookies. This takes the third party cookie |
| 69 // flag into account, and therefore needs to know whether we read or write a |
| 70 // cookie. |
| 71 // |
| 72 // This may be called on any thread. |
| 73 ContentSetting GetCookieContentSetting( |
| 74 const GURL& url, |
| 75 const GURL& first_party_url, |
| 76 bool setting_cookie) const; |
| 77 |
68 // Returns a single ContentSetting which applies to a given URL or | 78 // Returns a single ContentSetting which applies to a given URL or |
69 // CONTENT_SETTING_DEFAULT, if no exception applies. Note that certain | 79 // CONTENT_SETTING_DEFAULT, if no exception applies. Note that certain |
70 // internal schemes are whitelisted. For ContentSettingsTypes that require an | 80 // internal schemes are whitelisted. For ContentSettingsTypes that require an |
71 // resource identifier to be specified, the |resource_identifier| must be | 81 // resource identifier to be specified, the |resource_identifier| must be |
72 // non-empty. | 82 // non-empty. |
73 // | 83 // |
74 // This may be called on any thread. | 84 // This may be called on any thread. |
75 ContentSetting GetNonDefaultContentSetting( | 85 ContentSetting GetNonDefaultContentSetting( |
76 const GURL& url, | 86 const GURL& url, |
77 ContentSettingsType content_type, | 87 ContentSettingsType content_type, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 virtual void Observe(NotificationType type, | 172 virtual void Observe(NotificationType type, |
163 const NotificationSource& source, | 173 const NotificationSource& source, |
164 const NotificationDetails& details); | 174 const NotificationDetails& details); |
165 | 175 |
166 private: | 176 private: |
167 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 177 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
168 friend class DeleteTask<HostContentSettingsMap>; | 178 friend class DeleteTask<HostContentSettingsMap>; |
169 | 179 |
170 virtual ~HostContentSettingsMap(); | 180 virtual ~HostContentSettingsMap(); |
171 | 181 |
| 182 ContentSetting GetContentSettingInternal( |
| 183 const GURL& url, |
| 184 ContentSettingsType content_type, |
| 185 const std::string& resource_identifier) const; |
| 186 |
172 void UnregisterObservers(); | 187 void UnregisterObservers(); |
173 | 188 |
174 // Various migration methods (old cookie, popup and per-host data gets | 189 // Various migration methods (old cookie, popup and per-host data gets |
175 // migrated to the new format). | 190 // migrated to the new format). |
176 void MigrateObsoleteCookiePref(PrefService* prefs); | 191 void MigrateObsoleteCookiePref(PrefService* prefs); |
177 | 192 |
178 // The profile we're associated with. | 193 // The profile we're associated with. |
179 Profile* profile_; | 194 Profile* profile_; |
180 | 195 |
181 NotificationRegistrar notification_registrar_; | 196 NotificationRegistrar notification_registrar_; |
(...skipping 18 matching lines...) Expand all Loading... |
200 mutable base::Lock lock_; | 215 mutable base::Lock lock_; |
201 | 216 |
202 // Misc global settings. | 217 // Misc global settings. |
203 bool block_third_party_cookies_; | 218 bool block_third_party_cookies_; |
204 bool is_block_third_party_cookies_managed_; | 219 bool is_block_third_party_cookies_managed_; |
205 | 220 |
206 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 221 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
207 }; | 222 }; |
208 | 223 |
209 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 224 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |