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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 static void RegisterUserPrefs(PrefService* prefs); | 53 static void RegisterUserPrefs(PrefService* prefs); |
54 | 54 |
55 // Returns the default setting for a particular content type. If |provider_id| | 55 // Returns the default setting for a particular content type. If |provider_id| |
56 // is not NULL, the id of the provider which provided the default setting is | 56 // is not NULL, the id of the provider which provided the default setting is |
57 // assigned to it. | 57 // assigned to it. |
58 // | 58 // |
59 // This may be called on any thread. | 59 // This may be called on any thread. |
60 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type, | 60 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type, |
61 std::string* provider_id) const; | 61 std::string* provider_id) const; |
62 | 62 |
63 // Returns the default settings for all content types. | |
64 // | |
65 // This may be called on any thread. | |
66 ContentSettings GetDefaultContentSettings() const; | |
67 | |
68 // Returns a single |ContentSetting| which applies to the given URLs. Note | 63 // Returns a single |ContentSetting| which applies to the given URLs. Note |
69 // that certain internal schemes are whitelisted. For |CONTENT_TYPE_COOKIES|, | 64 // that certain internal schemes are whitelisted. For |CONTENT_TYPE_COOKIES|, |
70 // |CookieSettings| should be used instead. For content types that can't be | 65 // |CookieSettings| should be used instead. For content types that can't be |
71 // converted to a |ContentSetting|, |GetContentSettingValue| should be called. | 66 // converted to a |ContentSetting|, |GetContentSettingValue| should be called. |
72 // If there is no content setting, returns CONTENT_SETTING_DEFAULT. | 67 // If there is no content setting, returns CONTENT_SETTING_DEFAULT. |
73 // | 68 // |
74 // May be called on any thread. | 69 // May be called on any thread. |
75 ContentSetting GetContentSetting( | 70 ContentSetting GetContentSetting( |
76 const GURL& primary_url, | 71 const GURL& primary_url, |
77 const GURL& secondary_url, | 72 const GURL& secondary_url, |
(...skipping 13 matching lines...) Expand all Loading... |
91 // patterns. | 86 // patterns. |
92 // The ownership of the resulting |Value| is transfered to the caller. | 87 // The ownership of the resulting |Value| is transfered to the caller. |
93 // May be called on any thread. | 88 // May be called on any thread. |
94 base::Value* GetWebsiteSetting( | 89 base::Value* GetWebsiteSetting( |
95 const GURL& primary_url, | 90 const GURL& primary_url, |
96 const GURL& secondary_url, | 91 const GURL& secondary_url, |
97 ContentSettingsType content_type, | 92 ContentSettingsType content_type, |
98 const std::string& resource_identifier, | 93 const std::string& resource_identifier, |
99 content_settings::SettingInfo* info) const; | 94 content_settings::SettingInfo* info) const; |
100 | 95 |
101 // Returns all ContentSettings which apply to the given |primary_url|. For | |
102 // content setting types that require an additional resource identifier, the | |
103 // default content setting is returned. | |
104 // | |
105 // This may be called on any thread. | |
106 ContentSettings GetContentSettings( | |
107 const GURL& primary_url) const; | |
108 | |
109 // For a given content type, returns all patterns with a non-default setting, | 96 // For a given content type, returns all patterns with a non-default setting, |
110 // mapped to their actual settings, in the precedence order of the rules. | 97 // mapped to their actual settings, in the precedence order of the rules. |
111 // |settings| must be a non-NULL outparam. | 98 // |settings| must be a non-NULL outparam. |
112 // | 99 // |
113 // This may be called on any thread. | 100 // This may be called on any thread. |
114 void GetSettingsForOneType(ContentSettingsType content_type, | 101 void GetSettingsForOneType(ContentSettingsType content_type, |
115 const std::string& resource_identifier, | 102 const std::string& resource_identifier, |
116 ContentSettingsForOneType* settings) const; | 103 ContentSettingsForOneType* settings) const; |
117 | 104 |
118 // Sets the default setting for a particular content type. This method must | 105 // Sets the default setting for a particular content type. This method must |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Content setting providers. | 207 // Content setting providers. |
221 ProviderMap content_settings_providers_; | 208 ProviderMap content_settings_providers_; |
222 | 209 |
223 // Used around accesses to the following objects to guarantee thread safety. | 210 // Used around accesses to the following objects to guarantee thread safety. |
224 mutable base::Lock lock_; | 211 mutable base::Lock lock_; |
225 | 212 |
226 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 213 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
227 }; | 214 }; |
228 | 215 |
229 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 216 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |