Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/prefs/pref_change_registrar.h" | 18 #include "base/prefs/pref_change_registrar.h" |
| 19 #include "base/threading/platform_thread.h" | 19 #include "base/threading/platform_thread.h" |
| 20 #include "base/threading/thread_checker.h" | |
| 20 #include "base/tuple.h" | 21 #include "base/tuple.h" |
| 21 #include "chrome/browser/content_settings/content_settings_override_provider.h" | 22 #include "chrome/browser/content_settings/content_settings_override_provider.h" |
| 22 #include "components/content_settings/core/browser/content_settings_observer.h" | 23 #include "components/content_settings/core/browser/content_settings_observer.h" |
| 23 #include "components/content_settings/core/common/content_settings.h" | 24 #include "components/content_settings/core/common/content_settings.h" |
| 24 #include "components/content_settings/core/common/content_settings_pattern.h" | 25 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 25 #include "components/content_settings/core/common/content_settings_types.h" | 26 #include "components/content_settings/core/common/content_settings_types.h" |
| 26 | 27 |
| 27 class ExtensionService; | 28 class ExtensionService; |
| 28 class GURL; | 29 class GURL; |
| 29 class PrefService; | 30 class PrefService; |
| 30 | 31 |
| 31 namespace base { | 32 namespace base { |
| 32 class Clock; | 33 class Clock; |
| 33 class Value; | 34 class Value; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace content_settings { | 37 namespace content_settings { |
| 37 class OverrideProvider; | 38 class OverrideProvider; |
| 38 class ObservableProvider; | 39 class ObservableProvider; |
| 39 class ProviderInterface; | 40 class ProviderInterface; |
| 40 class PrefProvider; | 41 class PrefProvider; |
| 41 } | 42 } |
| 42 | 43 |
| 43 namespace user_prefs { | 44 namespace user_prefs { |
| 44 class PrefRegistrySyncable; | 45 class PrefRegistrySyncable; |
| 45 } | 46 } |
| 46 | 47 |
| 48 // Note that HostContentSettingsMap assumes it's created on the UI thread. | |
|
Bernhard Bauer
2014/10/01 11:41:09
Nit: Move this to the constructor, and change to m
Jun Mukai
2014/10/14 23:53:13
Done.
| |
| 47 class HostContentSettingsMap | 49 class HostContentSettingsMap |
| 48 : public content_settings::Observer, | 50 : public content_settings::Observer, |
| 49 public base::RefCountedThreadSafe<HostContentSettingsMap> { | 51 public base::RefCountedThreadSafe<HostContentSettingsMap> { |
| 50 public: | 52 public: |
| 51 enum ProviderType { | 53 enum ProviderType { |
| 52 // EXTENSION names is a layering violation when this class will move to | 54 // EXTENSION names is a layering violation when this class will move to |
| 53 // components. | 55 // components. |
| 54 // TODO(mukai): find the solution. | 56 // TODO(mukai): find the solution. |
| 55 INTERNAL_EXTENSION_PROVIDER = 0, | 57 INTERNAL_EXTENSION_PROVIDER = 0, |
| 56 POLICY_PROVIDER, | 58 POLICY_PROVIDER, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 PrefService* prefs_; | 349 PrefService* prefs_; |
| 348 | 350 |
| 349 // Whether this settings map is for an OTR session. | 351 // Whether this settings map is for an OTR session. |
| 350 bool is_off_the_record_; | 352 bool is_off_the_record_; |
| 351 | 353 |
| 352 // Content setting providers. This is only modified at construction | 354 // Content setting providers. This is only modified at construction |
| 353 // time and by RegisterExtensionService, both of which should happen | 355 // time and by RegisterExtensionService, both of which should happen |
| 354 // before any other uses of it. | 356 // before any other uses of it. |
| 355 ProviderMap content_settings_providers_; | 357 ProviderMap content_settings_providers_; |
| 356 | 358 |
| 359 base::ThreadChecker thread_checker_; | |
| 360 | |
| 357 ObserverList<content_settings::Observer> observers_; | 361 ObserverList<content_settings::Observer> observers_; |
| 358 | 362 |
| 359 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 363 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
| 360 }; | 364 }; |
| 361 | 365 |
| 362 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 366 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
| OLD | NEW |