Chromium Code Reviews| 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 |
| 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/linked_ptr.h" | 18 #include "base/linked_ptr.h" |
| 19 #include "base/ref_counted.h" | 19 #include "base/ref_counted.h" |
| 20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| 21 #include "chrome/browser/browser_thread.h" | 21 #include "chrome/browser/browser_thread.h" |
| 22 #include "chrome/browser/content_settings/content_settings_pattern.h" | 22 #include "chrome/browser/content_settings/content_settings_pattern.h" |
| 23 #include "chrome/browser/prefs/pref_change_registrar.h" | 23 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 24 #include "chrome/common/content_settings.h" | 24 #include "chrome/common/content_settings.h" |
| 25 #include "chrome/common/notification_observer.h" | 25 #include "chrome/common/notification_observer.h" |
| 26 #include "chrome/common/notification_registrar.h" | 26 #include "chrome/common/notification_registrar.h" |
| 27 | 27 |
| 28 namespace content_settings { | |
| 29 class DefaultContentSettingsProvider; | |
|
Bernhard Bauer
2011/01/26 15:51:59
Nit: Don't indent.
markusheintz_
2011/01/26 16:14:42
Done.
| |
| 30 } | |
| 31 | |
| 28 class ContentSettingsDetails; | 32 class ContentSettingsDetails; |
| 29 class DefaultContentSettingsProvider; | |
| 30 class DictionaryValue; | 33 class DictionaryValue; |
| 31 class GURL; | 34 class GURL; |
| 32 class PrefService; | 35 class PrefService; |
| 33 class Profile; | 36 class Profile; |
| 34 | 37 |
| 35 class HostContentSettingsMap | 38 class HostContentSettingsMap |
| 36 : public NotificationObserver, | 39 : public NotificationObserver, |
| 37 public base::RefCountedThreadSafe<HostContentSettingsMap, | 40 public base::RefCountedThreadSafe<HostContentSettingsMap, |
| 38 BrowserThread::DeleteOnUIThread> { | 41 BrowserThread::DeleteOnUIThread> { |
| 39 public: | 42 public: |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 PrefChangeRegistrar pref_change_registrar_; | 225 PrefChangeRegistrar pref_change_registrar_; |
| 223 | 226 |
| 224 // Whether this settings map is for an OTR session. | 227 // Whether this settings map is for an OTR session. |
| 225 bool is_off_the_record_; | 228 bool is_off_the_record_; |
| 226 | 229 |
| 227 // Whether we are currently updating preferences, this is used to ignore | 230 // Whether we are currently updating preferences, this is used to ignore |
| 228 // notifications from the preferences service that we triggered ourself. | 231 // notifications from the preferences service that we triggered ourself. |
| 229 bool updating_preferences_; | 232 bool updating_preferences_; |
| 230 | 233 |
| 231 // Content setting providers. | 234 // Content setting providers. |
| 232 std::vector<linked_ptr<DefaultContentSettingsProvider> > | 235 std::vector<linked_ptr<content_settings::DefaultContentSettingsProvider> > |
| 233 default_content_settings_providers_; | 236 default_content_settings_providers_; |
| 234 | 237 |
| 235 // Used around accesses to the following objects to guarantee thread safety. | 238 // Used around accesses to the following objects to guarantee thread safety. |
| 236 mutable base::Lock lock_; | 239 mutable base::Lock lock_; |
| 237 | 240 |
| 238 // Copies of the pref data, so that we can read it on threads other than the | 241 // Copies of the pref data, so that we can read it on threads other than the |
| 239 // UI thread. | 242 // UI thread. |
| 240 HostContentSettings host_content_settings_; | 243 HostContentSettings host_content_settings_; |
| 241 | 244 |
| 242 // Differences to the preference-stored host content settings for | 245 // Differences to the preference-stored host content settings for |
| 243 // off-the-record settings. | 246 // off-the-record settings. |
| 244 HostContentSettings off_the_record_settings_; | 247 HostContentSettings off_the_record_settings_; |
| 245 | 248 |
| 246 // Misc global settings. | 249 // Misc global settings. |
| 247 bool block_third_party_cookies_; | 250 bool block_third_party_cookies_; |
| 248 bool is_block_third_party_cookies_managed_; | 251 bool is_block_third_party_cookies_managed_; |
| 249 bool block_nonsandboxed_plugins_; | 252 bool block_nonsandboxed_plugins_; |
| 250 | 253 |
| 251 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 254 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
| 252 }; | 255 }; |
| 253 | 256 |
| 254 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 257 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
| OLD | NEW |