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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 class Value; | 26 class Value; |
27 } // namespace base | 27 } // namespace base |
28 | 28 |
29 namespace content_settings { | 29 namespace content_settings { |
30 class ProviderInterface; | 30 class ProviderInterface; |
31 } // namespace content_settings | 31 } // namespace content_settings |
32 | 32 |
33 class ExtensionService; | 33 class ExtensionService; |
34 class GURL; | 34 class GURL; |
35 class PrefService; | 35 class PrefService; |
| 36 class PrefServiceSyncable; |
36 | 37 |
37 class HostContentSettingsMap | 38 class HostContentSettingsMap |
38 : public content_settings::Observer, | 39 : public content_settings::Observer, |
39 public base::RefCountedThreadSafe<HostContentSettingsMap> { | 40 public base::RefCountedThreadSafe<HostContentSettingsMap> { |
40 public: | 41 public: |
41 enum ProviderType { | 42 enum ProviderType { |
42 INTERNAL_EXTENSION_PROVIDER = 0, | 43 INTERNAL_EXTENSION_PROVIDER = 0, |
43 POLICY_PROVIDER, | 44 POLICY_PROVIDER, |
44 CUSTOM_EXTENSION_PROVIDER, | 45 CUSTOM_EXTENSION_PROVIDER, |
45 PREF_PROVIDER, | 46 PREF_PROVIDER, |
46 DEFAULT_PROVIDER, | 47 DEFAULT_PROVIDER, |
47 NUM_PROVIDER_TYPES, | 48 NUM_PROVIDER_TYPES, |
48 }; | 49 }; |
49 | 50 |
50 HostContentSettingsMap(PrefService* prefs, | 51 HostContentSettingsMap(PrefService* prefs, bool incognito); |
51 bool incognito); | |
52 | 52 |
53 #if defined(ENABLE_EXTENSIONS) | 53 #if defined(ENABLE_EXTENSIONS) |
54 // In some cases, the ExtensionService is not available at the time the | 54 // In some cases, the ExtensionService is not available at the time the |
55 // HostContentSettingsMap is constructed. In these cases, we register the | 55 // HostContentSettingsMap is constructed. In these cases, we register the |
56 // service once it's available. | 56 // service once it's available. |
57 void RegisterExtensionService(ExtensionService* extension_service); | 57 void RegisterExtensionService(ExtensionService* extension_service); |
58 #endif | 58 #endif |
59 | 59 |
60 static void RegisterUserPrefs(PrefService* prefs); | 60 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
61 | 61 |
62 // Returns the default setting for a particular content type. If |provider_id| | 62 // Returns the default setting for a particular content type. If |provider_id| |
63 // is not NULL, the id of the provider which provided the default setting is | 63 // is not NULL, the id of the provider which provided the default setting is |
64 // assigned to it. | 64 // assigned to it. |
65 // | 65 // |
66 // This may be called on any thread. | 66 // This may be called on any thread. |
67 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type, | 67 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type, |
68 std::string* provider_id) const; | 68 std::string* provider_id) const; |
69 | 69 |
70 // Returns a single |ContentSetting| which applies to the given URLs. Note | 70 // Returns a single |ContentSetting| which applies to the given URLs. Note |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // Content setting providers. | 239 // Content setting providers. |
240 ProviderMap content_settings_providers_; | 240 ProviderMap content_settings_providers_; |
241 | 241 |
242 // Used around accesses to the following objects to guarantee thread safety. | 242 // Used around accesses to the following objects to guarantee thread safety. |
243 mutable base::Lock lock_; | 243 mutable base::Lock lock_; |
244 | 244 |
245 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); | 245 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); |
246 }; | 246 }; |
247 | 247 |
248 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ | 248 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ |
OLD | NEW |