OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HOST_CONTENT_SETTINGS_MAP_H_ | 8 #ifndef CHROME_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
9 #define CHROME_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 9 #define CHROME_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 const NotificationDetails& details); | 240 const NotificationDetails& details); |
241 | 241 |
242 private: | 242 private: |
243 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; | 243 friend class base::RefCountedThreadSafe<HostContentSettingsMap>; |
244 | 244 |
245 typedef std::pair<ContentSettingsType, std::string> | 245 typedef std::pair<ContentSettingsType, std::string> |
246 ContentSettingsTypeResourceIdentifierPair; | 246 ContentSettingsTypeResourceIdentifierPair; |
247 typedef std::map<ContentSettingsTypeResourceIdentifierPair, ContentSetting> | 247 typedef std::map<ContentSettingsTypeResourceIdentifierPair, ContentSetting> |
248 ResourceContentSettings; | 248 ResourceContentSettings; |
249 | 249 |
250 struct ExtendedContentSettings { | 250 struct ExtendedContentSettings; |
251 ContentSettings content_settings; | |
252 ResourceContentSettings content_settings_for_resources; | |
253 }; | |
254 | |
255 typedef std::map<std::string, ExtendedContentSettings> HostContentSettings; | 251 typedef std::map<std::string, ExtendedContentSettings> HostContentSettings; |
256 | 252 |
257 // Sets the fields of |settings| based on the values in |dictionary|. | 253 // Sets the fields of |settings| based on the values in |dictionary|. |
258 void GetSettingsFromDictionary(const DictionaryValue* dictionary, | 254 void GetSettingsFromDictionary(const DictionaryValue* dictionary, |
259 ContentSettings* settings); | 255 ContentSettings* settings); |
260 | 256 |
261 // Populates |settings| based on the values in |dictionary|. | 257 // Populates |settings| based on the values in |dictionary|. |
262 void GetResourceSettingsFromDictionary(const DictionaryValue* dictionary, | 258 void GetResourceSettingsFromDictionary(const DictionaryValue* dictionary, |
263 ResourceContentSettings* settings); | 259 ResourceContentSettings* settings); |
264 | 260 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 }; | 324 }; |
329 | 325 |
330 // Stream operator so HostContentSettingsMap::Pattern can be used in | 326 // Stream operator so HostContentSettingsMap::Pattern can be used in |
331 // assertion statements. | 327 // assertion statements. |
332 inline std::ostream& operator<<( | 328 inline std::ostream& operator<<( |
333 std::ostream& out, const HostContentSettingsMap::Pattern& pattern) { | 329 std::ostream& out, const HostContentSettingsMap::Pattern& pattern) { |
334 return out << pattern.AsString(); | 330 return out << pattern.AsString(); |
335 } | 331 } |
336 | 332 |
337 #endif // CHROME_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 333 #endif // CHROME_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |