| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // | 68 // |
| 69 // This may be called on any thread. | 69 // This may be called on any thread. |
| 70 ContentSetting GetDefaultContentSetting( | 70 ContentSetting GetDefaultContentSetting( |
| 71 ContentSettingsType content_type) const; | 71 ContentSettingsType content_type) const; |
| 72 | 72 |
| 73 // Returns the default settings for all content types. | 73 // Returns the default settings for all content types. |
| 74 // | 74 // |
| 75 // This may be called on any thread. | 75 // This may be called on any thread. |
| 76 ContentSettings GetDefaultContentSettings() const; | 76 ContentSettings GetDefaultContentSettings() const; |
| 77 | 77 |
| 78 // Returns a single ContentSetting which applies to the given URLs. Note that | 78 // Returns a single |ContentSetting| which applies to the given URLs. |
| 79 // certain internal schemes are whitelisted. For ContentSettingsTypes that | 79 // Note that certain internal schemes are whitelisted. |
| 80 // require a resource identifier to be specified, the |resource_identifier| | 80 // For |CONTENT_TYPE_COOKIES|, |GetCookieContentSetting| should be called, |
| 81 // must be non-empty. | 81 // and for content types that can't be converted to a ContentSetting, |
| 82 // | 82 // |GetContentSettingValue| should be called. |
| 83 // This may be called on any thread. | 83 // If there is no content setting, returns CONTENT_SETTING_DEFAULT. |
| 84 // May be called on any thread. |
| 84 ContentSetting GetContentSetting( | 85 ContentSetting GetContentSetting( |
| 85 const GURL& primary_url, | 86 const GURL& primary_url, |
| 86 const GURL& secondary_url, | 87 const GURL& secondary_url, |
| 87 ContentSettingsType content_type, | 88 ContentSettingsType content_type, |
| 88 const std::string& resource_identifier) const; | 89 const std::string& resource_identifier) const; |
| 89 | 90 |
| 90 // Returns a content setting |Value| which applies to the given URLs. Note | 91 // Returns a single content setting |Value| which applies to the given URLs. |
| 91 // that certain internal schemes are whitelisted. Ownership of the returned | 92 // If |primary_pattern| and |secondary_pattern| are not NULL, they are set to |
| 92 // |Value| is transfered to the caller. | 93 // the patterns of the applying rule. |
| 93 // | 94 // Note that certain internal schemes are whitelisted. |
| 94 // This may be called on any thread. | 95 // If there is no content setting, returns NULL and leaves |primary_pattern| |
| 96 // and |secondary_pattern| unchanged. |
| 97 // Otherwise transfers ownership of the resulting |Value| to the caller. |
| 98 // May be called on any thread. |
| 95 base::Value* GetContentSettingValue( | 99 base::Value* GetContentSettingValue( |
| 96 const GURL& primary_url, | 100 const GURL& primary_url, |
| 97 const GURL& secondary_url, | 101 const GURL& secondary_url, |
| 98 ContentSettingsType content_type, | 102 ContentSettingsType content_type, |
| 99 const std::string& resource_identifier) const; | 103 const std::string& resource_identifier, |
| 104 ContentSettingsPattern* primary_pattern, |
| 105 ContentSettingsPattern* secondary_pattern) const; |
| 100 | 106 |
| 101 // Gets the content setting for cookies. This takes the third party cookie | 107 // Gets the content setting for cookies. This takes the third party cookie |
| 102 // flag into account, and therefore needs to know whether we read or write a | 108 // flag into account, and therefore needs to know whether we read or write a |
| 103 // cookie. | 109 // cookie. |
| 104 // | 110 // |
| 105 // This may be called on any thread. | 111 // This may be called on any thread. |
| 106 ContentSetting GetCookieContentSetting( | 112 ContentSetting GetCookieContentSetting( |
| 107 const GURL& url, | 113 const GURL& url, |
| 108 const GURL& first_party_url, | 114 const GURL& first_party_url, |
| 109 bool setting_cookie) const; | 115 bool setting_cookie) const; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 mutable base::Lock lock_; | 259 mutable base::Lock lock_; |
| 254 | 260 |
| 255 // Misc global settings. | 261 // Misc global settings. |
| 256 bool block_third_party_cookies_; | 262 bool block_third_party_cookies_; |
| 257 bool is_block_third_party_cookies_managed_; | 263 bool is_block_third_party_cookies_managed_; |
| 258 | 264 |
| 259 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 265 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
| 260 }; | 266 }; |
| 261 | 267 |
| 262 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 268 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
| OLD | NEW |