| 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 "components/content_settings/core/browser/host_content_settings_map.h" | 5 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // the guest profile and so we need to ensure those get cleared. | 162 // the guest profile and so we need to ensure those get cleared. |
| 163 if (is_guest_profile) | 163 if (is_guest_profile) |
| 164 pref_provider_->ClearPrefs(); | 164 pref_provider_->ClearPrefs(); |
| 165 | 165 |
| 166 content_settings::ObservableProvider* default_provider = | 166 content_settings::ObservableProvider* default_provider = |
| 167 new content_settings::DefaultProvider(prefs_, is_off_the_record_); | 167 new content_settings::DefaultProvider(prefs_, is_off_the_record_); |
| 168 default_provider->AddObserver(this); | 168 default_provider->AddObserver(this); |
| 169 content_settings_providers_[DEFAULT_PROVIDER] = default_provider; | 169 content_settings_providers_[DEFAULT_PROVIDER] = default_provider; |
| 170 | 170 |
| 171 MigrateKeygenSettings(); | 171 MigrateKeygenSettings(); |
| 172 MigrateDomainScopedSettings(); | 172 |
| 173 if (prefs_->GetInteger(prefs::kContentSettingsMigrationStatus) == |
| 174 content_settings::NOT_MIGRATED) { |
| 175 MigrateDomainScopedSettings(); |
| 176 prefs_->SetInteger(prefs::kContentSettingsMigrationStatus, |
| 177 content_settings::DONE_IN_HCSM); |
| 178 } |
| 179 |
| 173 RecordNumberOfExceptions(); | 180 RecordNumberOfExceptions(); |
| 174 } | 181 } |
| 175 | 182 |
| 176 // static | 183 // static |
| 177 void HostContentSettingsMap::RegisterProfilePrefs( | 184 void HostContentSettingsMap::RegisterProfilePrefs( |
| 178 user_prefs::PrefRegistrySyncable* registry) { | 185 user_prefs::PrefRegistrySyncable* registry) { |
| 179 // Ensure the content settings are all registered. | 186 // Ensure the content settings are all registered. |
| 180 content_settings::ContentSettingsRegistry::GetInstance(); | 187 content_settings::ContentSettingsRegistry::GetInstance(); |
| 181 | 188 |
| 182 registry->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, 0); | 189 registry->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, 0); |
| 190 registry->RegisterIntegerPref(prefs::kContentSettingsMigrationStatus, |
| 191 content_settings::NOT_MIGRATED); |
| 183 | 192 |
| 184 // Register the prefs for the content settings providers. | 193 // Register the prefs for the content settings providers. |
| 185 content_settings::DefaultProvider::RegisterProfilePrefs(registry); | 194 content_settings::DefaultProvider::RegisterProfilePrefs(registry); |
| 186 content_settings::PrefProvider::RegisterProfilePrefs(registry); | 195 content_settings::PrefProvider::RegisterProfilePrefs(registry); |
| 187 content_settings::PolicyProvider::RegisterProfilePrefs(registry); | 196 content_settings::PolicyProvider::RegisterProfilePrefs(registry); |
| 188 } | 197 } |
| 189 | 198 |
| 190 void HostContentSettingsMap::RegisterProvider( | 199 void HostContentSettingsMap::RegisterProvider( |
| 191 ProviderType type, | 200 ProviderType type, |
| 192 std::unique_ptr<content_settings::ObservableProvider> provider) { | 201 std::unique_ptr<content_settings::ObservableProvider> provider) { |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 *secondary_pattern = rule.secondary_pattern; | 923 *secondary_pattern = rule.secondary_pattern; |
| 915 return base::WrapUnique(rule.value.get()->DeepCopy()); | 924 return base::WrapUnique(rule.value.get()->DeepCopy()); |
| 916 } | 925 } |
| 917 } | 926 } |
| 918 return std::unique_ptr<base::Value>(); | 927 return std::unique_ptr<base::Value>(); |
| 919 } | 928 } |
| 920 | 929 |
| 921 base::WeakPtr<HostContentSettingsMap> HostContentSettingsMap::GetWeakPtr() { | 930 base::WeakPtr<HostContentSettingsMap> HostContentSettingsMap::GetWeakPtr() { |
| 922 return weak_ptr_factory_.GetWeakPtr(); | 931 return weak_ptr_factory_.GetWeakPtr(); |
| 923 } | 932 } |
| OLD | NEW |