| 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" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 new content_settings::PrefProvider(prefs_, is_off_the_record_); | 113 new content_settings::PrefProvider(prefs_, is_off_the_record_); |
| 114 pref_provider->AddObserver(this); | 114 pref_provider->AddObserver(this); |
| 115 content_settings_providers_[PREF_PROVIDER] = pref_provider; | 115 content_settings_providers_[PREF_PROVIDER] = pref_provider; |
| 116 | 116 |
| 117 content_settings::ObservableProvider* default_provider = | 117 content_settings::ObservableProvider* default_provider = |
| 118 new content_settings::DefaultProvider(prefs_, is_off_the_record_); | 118 new content_settings::DefaultProvider(prefs_, is_off_the_record_); |
| 119 default_provider->AddObserver(this); | 119 default_provider->AddObserver(this); |
| 120 content_settings_providers_[DEFAULT_PROVIDER] = default_provider; | 120 content_settings_providers_[DEFAULT_PROVIDER] = default_provider; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void HostContentSettingsMap::RegisterExtensionService( |
| 124 ExtensionService* extension_service) { |
| 125 DCHECK(extension_service); |
| 126 DCHECK(!content_settings_providers_[PLATFORM_APP_PROVIDER]); |
| 127 DCHECK(!content_settings_providers_[EXTENSION_PROVIDER]); |
| 128 |
| 129 content_settings::PlatformAppProvider* platform_app_provider = |
| 130 new content_settings::PlatformAppProvider(extension_service); |
| 131 platform_app_provider->AddObserver(this); |
| 132 content_settings_providers_[PLATFORM_APP_PROVIDER] = platform_app_provider; |
| 133 |
| 134 content_settings::ObservableProvider* extension_provider = |
| 135 new content_settings::ExtensionProvider( |
| 136 extension_service->GetContentSettingsStore(), |
| 137 is_off_the_record_); |
| 138 extension_provider->AddObserver(this); |
| 139 content_settings_providers_[EXTENSION_PROVIDER] = extension_provider; |
| 140 |
| 141 OnContentSettingChanged(ContentSettingsPattern(), |
| 142 ContentSettingsPattern(), |
| 143 CONTENT_SETTINGS_TYPE_DEFAULT, |
| 144 ""); |
| 145 } |
| 146 |
| 123 // static | 147 // static |
| 124 void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { | 148 void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { |
| 125 prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, | 149 prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, |
| 126 0, | 150 0, |
| 127 PrefService::UNSYNCABLE_PREF); | 151 PrefService::UNSYNCABLE_PREF); |
| 128 prefs->RegisterIntegerPref(prefs::kContentSettingsDefaultWhitelistVersion, | 152 prefs->RegisterIntegerPref(prefs::kContentSettingsDefaultWhitelistVersion, |
| 129 0, PrefService::SYNCABLE_PREF); | 153 0, PrefService::SYNCABLE_PREF); |
| 130 | 154 |
| 131 // Register the prefs for the content settings providers. | 155 // Register the prefs for the content settings providers. |
| 132 content_settings::DefaultProvider::RegisterUserPrefs(prefs); | 156 content_settings::DefaultProvider::RegisterUserPrefs(prefs); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 491 } |
| 468 } | 492 } |
| 469 | 493 |
| 470 if (info) { | 494 if (info) { |
| 471 info->source = content_settings::SETTING_SOURCE_NONE; | 495 info->source = content_settings::SETTING_SOURCE_NONE; |
| 472 info->primary_pattern = ContentSettingsPattern(); | 496 info->primary_pattern = ContentSettingsPattern(); |
| 473 info->secondary_pattern = ContentSettingsPattern(); | 497 info->secondary_pattern = ContentSettingsPattern(); |
| 474 } | 498 } |
| 475 return NULL; | 499 return NULL; |
| 476 } | 500 } |
| OLD | NEW |