| 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 |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/lock.h" | 18 #include "base/lock.h" |
| 19 #include "base/ref_counted.h" | 19 #include "base/ref_counted.h" |
| 20 #include "chrome/browser/chrome_thread.h" | 20 #include "chrome/browser/chrome_thread.h" |
| 21 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 21 #include "chrome/common/content_settings.h" | 22 #include "chrome/common/content_settings.h" |
| 22 #include "chrome/common/notification_observer.h" | 23 #include "chrome/common/notification_observer.h" |
| 23 #include "chrome/common/notification_registrar.h" | 24 #include "chrome/common/notification_registrar.h" |
| 24 | 25 |
| 25 class DictionaryValue; | 26 class DictionaryValue; |
| 26 class GURL; | 27 class GURL; |
| 27 class PrefService; | 28 class PrefService; |
| 28 class Profile; | 29 class Profile; |
| 29 | 30 |
| 30 class HostContentSettingsMap | 31 class HostContentSettingsMap |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // of the GetSettings functions in response, which would then lead to a | 279 // of the GetSettings functions in response, which would then lead to a |
| 279 // mutex deadlock. | 280 // mutex deadlock. |
| 280 void NotifyObservers(const ContentSettingsDetails& details); | 281 void NotifyObservers(const ContentSettingsDetails& details); |
| 281 | 282 |
| 282 void UnregisterObservers(); | 283 void UnregisterObservers(); |
| 283 | 284 |
| 284 // The profile we're associated with. | 285 // The profile we're associated with. |
| 285 Profile* profile_; | 286 Profile* profile_; |
| 286 | 287 |
| 287 NotificationRegistrar notification_registrar_; | 288 NotificationRegistrar notification_registrar_; |
| 289 PrefChangeRegistrar pref_change_registrar_; |
| 288 | 290 |
| 289 // Copies of the pref data, so that we can read it on the IO thread. | 291 // Copies of the pref data, so that we can read it on the IO thread. |
| 290 ContentSettings default_content_settings_; | 292 ContentSettings default_content_settings_; |
| 291 HostContentSettings host_content_settings_; | 293 HostContentSettings host_content_settings_; |
| 292 | 294 |
| 293 // Differences to the preference-stored host content settings for | 295 // Differences to the preference-stored host content settings for |
| 294 // off-the-record settings. | 296 // off-the-record settings. |
| 295 HostContentSettings off_the_record_settings_; | 297 HostContentSettings off_the_record_settings_; |
| 296 | 298 |
| 297 // Misc global settings. | 299 // Misc global settings. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 312 }; | 314 }; |
| 313 | 315 |
| 314 // Stream operator so HostContentSettingsMap::Pattern can be used in | 316 // Stream operator so HostContentSettingsMap::Pattern can be used in |
| 315 // assertion statements. | 317 // assertion statements. |
| 316 inline std::ostream& operator<<( | 318 inline std::ostream& operator<<( |
| 317 std::ostream& out, const HostContentSettingsMap::Pattern& pattern) { | 319 std::ostream& out, const HostContentSettingsMap::Pattern& pattern) { |
| 318 return out << pattern.AsString(); | 320 return out << pattern.AsString(); |
| 319 } | 321 } |
| 320 | 322 |
| 321 #endif // CHROME_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ | 323 #endif // CHROME_BROWSER_HOST_CONTENT_SETTINGS_MAP_H_ |
| OLD | NEW |