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 #include "chrome/browser/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/content_settings/content_settings_custom_extension_prov
ider.h" | 14 #include "chrome/browser/content_settings/content_settings_custom_extension_prov
ider.h" |
15 #include "chrome/browser/content_settings/content_settings_default_provider.h" | 15 #include "chrome/browser/content_settings/content_settings_default_provider.h" |
16 #include "chrome/browser/content_settings/content_settings_details.h" | 16 #include "chrome/browser/content_settings/content_settings_details.h" |
17 #include "chrome/browser/content_settings/content_settings_internal_extension_pr
ovider.h" | 17 #include "chrome/browser/content_settings/content_settings_internal_extension_pr
ovider.h" |
18 #include "chrome/browser/content_settings/content_settings_observable_provider.h
" | 18 #include "chrome/browser/content_settings/content_settings_observable_provider.h
" |
19 #include "chrome/browser/content_settings/content_settings_policy_provider.h" | 19 #include "chrome/browser/content_settings/content_settings_policy_provider.h" |
20 #include "chrome/browser/content_settings/content_settings_pref_provider.h" | 20 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
21 #include "chrome/browser/content_settings/content_settings_provider.h" | 21 #include "chrome/browser/content_settings/content_settings_provider.h" |
22 #include "chrome/browser/content_settings/content_settings_rule.h" | 22 #include "chrome/browser/content_settings/content_settings_rule.h" |
23 #include "chrome/browser/content_settings/content_settings_utils.h" | 23 #include "chrome/browser/content_settings/content_settings_utils.h" |
24 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
25 #include "chrome/browser/intents/web_intents_util.h" | 25 #include "chrome/browser/intents/web_intents_util.h" |
| 26 #include "chrome/browser/prefs/pref_registry_syncable.h" |
26 #include "chrome/browser/prefs/pref_service.h" | 27 #include "chrome/browser/prefs/pref_service.h" |
27 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/content_settings_pattern.h" | 30 #include "chrome/common/content_settings_pattern.h" |
30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
35 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 custom_extension_provider; | 124 custom_extension_provider; |
124 | 125 |
125 OnContentSettingChanged(ContentSettingsPattern(), | 126 OnContentSettingChanged(ContentSettingsPattern(), |
126 ContentSettingsPattern(), | 127 ContentSettingsPattern(), |
127 CONTENT_SETTINGS_TYPE_DEFAULT, | 128 CONTENT_SETTINGS_TYPE_DEFAULT, |
128 ""); | 129 ""); |
129 } | 130 } |
130 #endif | 131 #endif |
131 | 132 |
132 // static | 133 // static |
133 void HostContentSettingsMap::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 134 void HostContentSettingsMap::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
134 prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, | 135 registry->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, |
135 0, | 136 0, |
136 PrefServiceSyncable::UNSYNCABLE_PREF); | 137 PrefRegistrySyncable::UNSYNCABLE_PREF); |
137 prefs->RegisterIntegerPref(prefs::kContentSettingsDefaultWhitelistVersion, | 138 registry->RegisterIntegerPref(prefs::kContentSettingsDefaultWhitelistVersion, |
138 0, PrefServiceSyncable::SYNCABLE_PREF); | 139 0, |
139 prefs->RegisterBooleanPref(prefs::kContentSettingsClearOnExitMigrated, | 140 PrefRegistrySyncable::SYNCABLE_PREF); |
140 false, PrefServiceSyncable::SYNCABLE_PREF); | 141 registry->RegisterBooleanPref(prefs::kContentSettingsClearOnExitMigrated, |
| 142 false, |
| 143 PrefRegistrySyncable::SYNCABLE_PREF); |
141 | 144 |
142 // Register the prefs for the content settings providers. | 145 // Register the prefs for the content settings providers. |
143 content_settings::DefaultProvider::RegisterUserPrefs(prefs); | 146 content_settings::DefaultProvider::RegisterUserPrefs(registry); |
144 content_settings::PrefProvider::RegisterUserPrefs(prefs); | 147 content_settings::PrefProvider::RegisterUserPrefs(registry); |
145 content_settings::PolicyProvider::RegisterUserPrefs(prefs); | 148 content_settings::PolicyProvider::RegisterUserPrefs(registry); |
146 } | 149 } |
147 | 150 |
148 ContentSetting HostContentSettingsMap::GetDefaultContentSettingFromProvider( | 151 ContentSetting HostContentSettingsMap::GetDefaultContentSettingFromProvider( |
149 ContentSettingsType content_type, | 152 ContentSettingsType content_type, |
150 content_settings::ProviderInterface* provider) const { | 153 content_settings::ProviderInterface* provider) const { |
151 scoped_ptr<content_settings::RuleIterator> rule_iterator( | 154 scoped_ptr<content_settings::RuleIterator> rule_iterator( |
152 provider->GetRuleIterator(content_type, "", false)); | 155 provider->GetRuleIterator(content_type, "", false)); |
153 | 156 |
154 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); | 157 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); |
155 while (rule_iterator->HasNext()) { | 158 while (rule_iterator->HasNext()) { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 HostContentSettingsMap::GetProviderTypeFromSource( | 583 HostContentSettingsMap::GetProviderTypeFromSource( |
581 const std::string& source) { | 584 const std::string& source) { |
582 for (size_t i = 0; i < arraysize(kProviderNames); ++i) { | 585 for (size_t i = 0; i < arraysize(kProviderNames); ++i) { |
583 if (source == kProviderNames[i]) | 586 if (source == kProviderNames[i]) |
584 return static_cast<ProviderType>(i); | 587 return static_cast<ProviderType>(i); |
585 } | 588 } |
586 | 589 |
587 NOTREACHED(); | 590 NOTREACHED(); |
588 return DEFAULT_PROVIDER; | 591 return DEFAULT_PROVIDER; |
589 } | 592 } |
OLD | NEW |