Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map.h

Issue 8383004: Adding CookieSettings for storing cookie content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // 70 //
71 // This may be called on any thread. 71 // This may be called on any thread.
72 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type, 72 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type,
73 std::string* provider_id) const; 73 std::string* provider_id) const;
74 74
75 // Returns the default settings for all content types. 75 // Returns the default settings for all content types.
76 // 76 //
77 // This may be called on any thread. 77 // This may be called on any thread.
78 ContentSettings GetDefaultContentSettings() const; 78 ContentSettings GetDefaultContentSettings() const;
79 79
80 // Returns a single |ContentSetting| which applies to the given URLs. 80 // Returns a single |ContentSetting| which applies to the given URLs. Note
81 // Note that certain internal schemes are whitelisted. 81 // that certain internal schemes are whitelisted. For |CONTENT_TYPE_COOKIES|,
82 // For |CONTENT_TYPE_COOKIES|, |GetCookieContentSetting| should be called, 82 // |CookieSettings| should be used instead. For content types that can't be
83 // and for content types that can't be converted to a ContentSetting, 83 // converted to a |ContentSetting|, |GetContentSettingValue| should be called.
84 // |GetContentSettingValue| should be called.
85 // If there is no content setting, returns CONTENT_SETTING_DEFAULT. 84 // If there is no content setting, returns CONTENT_SETTING_DEFAULT.
85 //
86 // May be called on any thread. 86 // May be called on any thread.
87 ContentSetting GetContentSetting( 87 ContentSetting GetContentSetting(
88 const GURL& primary_url, 88 const GURL& primary_url,
89 const GURL& secondary_url, 89 const GURL& secondary_url,
90 ContentSettingsType content_type, 90 ContentSettingsType content_type,
91 const std::string& resource_identifier) const; 91 const std::string& resource_identifier) const;
92 92
93 // Returns a single content setting |Value| which applies to the given URLs. 93 // Returns a single content setting |Value| which applies to the given URLs.
94 // If |primary_pattern| and |secondary_pattern| are not NULL, they are set to 94 // If |primary_pattern| and |secondary_pattern| are not NULL, they are set to
95 // the patterns of the applying rule. 95 // the patterns of the applying rule.
96 // Note that certain internal schemes are whitelisted. 96 // Note that certain internal schemes are whitelisted.
97 // If there is no content setting, returns NULL and leaves |primary_pattern| 97 // If there is no content setting, returns NULL and leaves |primary_pattern|
98 // and |secondary_pattern| unchanged. 98 // and |secondary_pattern| unchanged.
99 // Otherwise transfers ownership of the resulting |Value| to the caller. 99 // Otherwise transfers ownership of the resulting |Value| to the caller.
100 // May be called on any thread. 100 // May be called on any thread.
101 base::Value* GetContentSettingValue( 101 base::Value* GetContentSettingValue(
102 const GURL& primary_url, 102 const GURL& primary_url,
103 const GURL& secondary_url, 103 const GURL& secondary_url,
104 ContentSettingsType content_type, 104 ContentSettingsType content_type,
105 const std::string& resource_identifier, 105 const std::string& resource_identifier,
106 ContentSettingsPattern* primary_pattern, 106 ContentSettingsPattern* primary_pattern,
107 ContentSettingsPattern* secondary_pattern) const; 107 ContentSettingsPattern* secondary_pattern) const;
108 108
109 // Gets the content setting for cookies. This takes the third party cookie 109 // Returns all ContentSettings which apply to the given |primary_url|. For
110 // flag into account, and therefore needs to know whether we read or write a 110 // content setting types that require an additional resource identifier, the
111 // cookie. 111 // default content setting is returned.
112 //
113 // This may be called on any thread.
114 ContentSetting GetCookieContentSetting(
115 const GURL& url,
116 const GURL& first_party_url,
117 bool setting_cookie) const;
118
119 // Returns all ContentSettings which apply to the given URLs. For content
120 // setting types that require an additional resource identifier, the default
121 // content setting is returned.
122 // 112 //
123 // This may be called on any thread. 113 // This may be called on any thread.
124 ContentSettings GetContentSettings( 114 ContentSettings GetContentSettings(
125 const GURL& primary_url, 115 const GURL& primary_url) const;
126 const GURL& secondary_url) const;
127 116
128 // For a given content type, returns all patterns with a non-default setting, 117 // For a given content type, returns all patterns with a non-default setting,
129 // mapped to their actual settings, in lexicographical order. |settings| 118 // mapped to their actual settings, in lexicographical order. |settings|
130 // must be a non-NULL outparam. If this map was created for the 119 // must be a non-NULL outparam. If this map was created for the
131 // incognito profile, it will only return those settings differing from 120 // incognito profile, it will only return those settings differing from
132 // the main map. For ContentSettingsTypes that require an resource identifier 121 // the main map. For ContentSettingsTypes that require an resource identifier
133 // to be specified, the |resource_identifier| must be non-empty. 122 // to be specified, the |resource_identifier| must be non-empty.
134 // 123 //
135 // This may be called on any thread. 124 // This may be called on any thread.
136 void GetSettingsForOneType(ContentSettingsType content_type, 125 void GetSettingsForOneType(ContentSettingsType content_type,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ContentSettingsPattern primary_pattern, 189 ContentSettingsPattern primary_pattern,
201 ContentSettingsPattern secondary_pattern, 190 ContentSettingsPattern secondary_pattern,
202 ContentSettingsType content_type, 191 ContentSettingsType content_type,
203 std::string resource_identifier); 192 std::string resource_identifier);
204 193
205 // content::NotificationObserver implementation. 194 // content::NotificationObserver implementation.
206 virtual void Observe(int type, 195 virtual void Observe(int type,
207 const content::NotificationSource& source, 196 const content::NotificationSource& source,
208 const content::NotificationDetails& details); 197 const content::NotificationDetails& details);
209 198
199 // Returns true if we should allow all content types for this URL. This is
200 // true for various internal objects like chrome:// URLs, so UI and other
201 // things users think of as "not webpages" don't break.
202 static bool ShouldAllowAllContent(const GURL& url,
203 ContentSettingsType content_type);
204
210 private: 205 private:
211 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; 206 friend class base::RefCountedThreadSafe<HostContentSettingsMap>;
212 friend class HostContentSettingsMapTest_NonDefaultSettings_Test; 207 friend class HostContentSettingsMapTest_NonDefaultSettings_Test;
213 208
214 typedef std::map<ProviderType, content_settings::ProviderInterface*> 209 typedef std::map<ProviderType, content_settings::ProviderInterface*>
215 ProviderMap; 210 ProviderMap;
216 typedef ProviderMap::iterator ProviderIterator; 211 typedef ProviderMap::iterator ProviderIterator;
217 typedef ProviderMap::const_iterator ConstProviderIterator; 212 typedef ProviderMap::const_iterator ConstProviderIterator;
218 213
219 virtual ~HostContentSettingsMap(); 214 virtual ~HostContentSettingsMap();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 mutable base::Lock lock_; 253 mutable base::Lock lock_;
259 254
260 // Misc global settings. 255 // Misc global settings.
261 bool block_third_party_cookies_; 256 bool block_third_party_cookies_;
262 bool is_block_third_party_cookies_managed_; 257 bool is_block_third_party_cookies_managed_;
263 258
264 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); 259 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
265 }; 260 };
266 261
267 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 262 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698