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

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

Issue 7831075: Delegating the "are images allowed" decision to renderer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Doc fix. Created 9 years, 1 month 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public base::RefCountedThreadSafe<HostContentSettingsMap> { 42 public base::RefCountedThreadSafe<HostContentSettingsMap> {
43 public: 43 public:
44 enum ProviderType { 44 enum ProviderType {
45 POLICY_PROVIDER = 0, 45 POLICY_PROVIDER = 0,
46 EXTENSION_PROVIDER = 1, 46 EXTENSION_PROVIDER = 1,
47 PREF_PROVIDER, 47 PREF_PROVIDER,
48 DEFAULT_PROVIDER, 48 DEFAULT_PROVIDER,
49 NUM_PROVIDER_TYPES, 49 NUM_PROVIDER_TYPES,
50 }; 50 };
51 51
52 // TODO(markusheintz): I sold my soul to the devil on order to add this tuple.
53 // I really want my soul back, so I really will change this ASAP.
54 typedef Tuple5<ContentSettingsPattern,
55 ContentSettingsPattern,
56 ContentSetting,
57 std::string,
58 bool> PatternSettingSourceTuple;
59 typedef std::vector<PatternSettingSourceTuple> SettingsForOneType;
60
61 HostContentSettingsMap(PrefService* prefs, 52 HostContentSettingsMap(PrefService* prefs,
62 ExtensionService* extension_service, 53 ExtensionService* extension_service,
63 bool incognito); 54 bool incognito);
64 55
65 static void RegisterUserPrefs(PrefService* prefs); 56 static void RegisterUserPrefs(PrefService* prefs);
66 57
67 // Returns the default setting for a particular content type. If |provider_id| 58 // Returns the default setting for a particular content type. If |provider_id|
68 // is not NULL, the id of the provider which provided the default setting is 59 // is not NULL, the id of the provider which provided the default setting is
69 // assigned to it. 60 // assigned to it.
70 // 61 //
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Returns all ContentSettings which apply to the given URLs. For content 110 // Returns all ContentSettings which apply to the given URLs. For content
120 // setting types that require an additional resource identifier, the default 111 // setting types that require an additional resource identifier, the default
121 // content setting is returned. 112 // content setting is returned.
122 // 113 //
123 // This may be called on any thread. 114 // This may be called on any thread.
124 ContentSettings GetContentSettings( 115 ContentSettings GetContentSettings(
125 const GURL& primary_url, 116 const GURL& primary_url,
126 const GURL& secondary_url) const; 117 const GURL& secondary_url) const;
127 118
128 // For a given content type, returns all patterns with a non-default setting, 119 // For a given content type, returns all patterns with a non-default setting,
129 // mapped to their actual settings, in lexicographical order. |settings| 120 // mapped to their actual settings, in the precedence order of the rules.
130 // must be a non-NULL outparam. If this map was created for the 121 // |settings| must be a non-NULL outparam.
131 // incognito profile, it will only return those settings differing from
132 // the main map. For ContentSettingsTypes that require an resource identifier
133 // to be specified, the |resource_identifier| must be non-empty.
134 // 122 //
135 // This may be called on any thread. 123 // This may be called on any thread.
136 void GetSettingsForOneType(ContentSettingsType content_type, 124 void GetSettingsForOneType(ContentSettingsType content_type,
137 const std::string& resource_identifier, 125 const std::string& resource_identifier,
138 SettingsForOneType* settings) const; 126 ContentSettingsForOneType* settings) const;
139 127
140 // Sets the default setting for a particular content type. This method must 128 // Sets the default setting for a particular content type. This method must
141 // not be invoked on an incognito map. 129 // not be invoked on an incognito map.
142 // 130 //
143 // This should only be called on the UI thread. 131 // This should only be called on the UI thread.
144 void SetDefaultContentSetting(ContentSettingsType content_type, 132 void SetDefaultContentSetting(ContentSettingsType content_type,
145 ContentSetting setting); 133 ContentSetting setting);
146 134
147 // Sets the content setting for the given patterns and content type. 135 // Sets the content setting for the given patterns and content type.
148 // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting 136 // Setting the value to CONTENT_SETTING_DEFAULT causes the default setting
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Adds content settings for |content_type| and |resource_identifier|, 217 // Adds content settings for |content_type| and |resource_identifier|,
230 // provided by |provider|, into |settings|. If |incognito| is true, adds only 218 // provided by |provider|, into |settings|. If |incognito| is true, adds only
231 // the content settings which are applicable to the incognito mode and differ 219 // the content settings which are applicable to the incognito mode and differ
232 // from the normal mode. Otherwise, adds the content settings for the normal 220 // from the normal mode. Otherwise, adds the content settings for the normal
233 // mode. 221 // mode.
234 void AddSettingsForOneType( 222 void AddSettingsForOneType(
235 const content_settings::ProviderInterface* provider, 223 const content_settings::ProviderInterface* provider,
236 ProviderType provider_type, 224 ProviderType provider_type,
237 ContentSettingsType content_type, 225 ContentSettingsType content_type,
238 const std::string& resource_identifier, 226 const std::string& resource_identifier,
239 SettingsForOneType* settings, 227 ContentSettingsForOneType* settings,
240 bool incognito) const; 228 bool incognito) const;
241 229
242 // Weak; owned by the Profile. 230 // Weak; owned by the Profile.
243 PrefService* prefs_; 231 PrefService* prefs_;
244 232
245 PrefChangeRegistrar pref_change_registrar_; 233 PrefChangeRegistrar pref_change_registrar_;
246 234
247 // Whether this settings map is for an OTR session. 235 // Whether this settings map is for an OTR session.
248 bool is_off_the_record_; 236 bool is_off_the_record_;
249 237
250 // Whether we are currently updating preferences, this is used to ignore 238 // Whether we are currently updating preferences, this is used to ignore
251 // notifications from the preferences service that we triggered ourself. 239 // notifications from the preferences service that we triggered ourself.
252 bool updating_preferences_; 240 bool updating_preferences_;
253 241
254 // Content setting providers. 242 // Content setting providers.
255 ProviderMap content_settings_providers_; 243 ProviderMap content_settings_providers_;
256 244
257 // Used around accesses to the following objects to guarantee thread safety. 245 // Used around accesses to the following objects to guarantee thread safety.
258 mutable base::Lock lock_; 246 mutable base::Lock lock_;
259 247
260 // Misc global settings. 248 // Misc global settings.
261 bool block_third_party_cookies_; 249 bool block_third_party_cookies_;
262 bool is_block_third_party_cookies_managed_; 250 bool is_block_third_party_cookies_managed_;
263 251
264 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); 252 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
265 }; 253 };
266 254
267 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 255 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/content_settings/host_content_settings_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698