| 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_default_provider.h" | 14 #include "chrome/browser/content_settings/content_settings_default_provider.h" |
| 15 #include "chrome/browser/content_settings/content_settings_details.h" | 15 #include "chrome/browser/content_settings/content_settings_details.h" |
| 16 #include "chrome/browser/content_settings/content_settings_extension_provider.h" | 16 #include "chrome/browser/content_settings/content_settings_custom_extension_prov
ider.h" |
| 17 #include "chrome/browser/content_settings/content_settings_observable_provider.h
" | 17 #include "chrome/browser/content_settings/content_settings_observable_provider.h
" |
| 18 #include "chrome/browser/content_settings/content_settings_platform_app_provider
.h" | 18 #include "chrome/browser/content_settings/content_settings_internal_extension_pr
ovider.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_service.h" | 26 #include "chrome/browser/prefs/pref_service.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 if (!is_off_the_record_) { | 97 if (!is_off_the_record_) { |
| 98 // Migrate obsolete preferences. | 98 // Migrate obsolete preferences. |
| 99 MigrateObsoleteClearOnExitPref(); | 99 MigrateObsoleteClearOnExitPref(); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 void HostContentSettingsMap::RegisterExtensionService( | 103 void HostContentSettingsMap::RegisterExtensionService( |
| 104 ExtensionService* extension_service) { | 104 ExtensionService* extension_service) { |
| 105 DCHECK(extension_service); | 105 DCHECK(extension_service); |
| 106 DCHECK(!content_settings_providers_[PLATFORM_APP_PROVIDER]); | 106 DCHECK(!content_settings_providers_[INTERNAL_EXTENSION_PROVIDER]); |
| 107 DCHECK(!content_settings_providers_[EXTENSION_PROVIDER]); | 107 DCHECK(!content_settings_providers_[CUSTOM_EXTENSION_PROVIDER]); |
| 108 | 108 |
| 109 content_settings::PlatformAppProvider* platform_app_provider = | 109 content_settings::InternalExtensionProvider* internal_extension_provider = |
| 110 new content_settings::PlatformAppProvider(extension_service); | 110 new content_settings::InternalExtensionProvider(extension_service); |
| 111 platform_app_provider->AddObserver(this); | 111 internal_extension_provider->AddObserver(this); |
| 112 content_settings_providers_[PLATFORM_APP_PROVIDER] = platform_app_provider; | 112 content_settings_providers_[INTERNAL_EXTENSION_PROVIDER] = |
| 113 internal_extension_provider; |
| 113 | 114 |
| 114 content_settings::ObservableProvider* extension_provider = | 115 content_settings::ObservableProvider* custom_extension_provider = |
| 115 new content_settings::ExtensionProvider( | 116 new content_settings::CustomExtensionProvider( |
| 116 extension_service->GetContentSettingsStore(), | 117 extension_service->GetContentSettingsStore(), |
| 117 is_off_the_record_); | 118 is_off_the_record_); |
| 118 extension_provider->AddObserver(this); | 119 custom_extension_provider->AddObserver(this); |
| 119 content_settings_providers_[EXTENSION_PROVIDER] = extension_provider; | 120 content_settings_providers_[CUSTOM_EXTENSION_PROVIDER] = |
| 121 custom_extension_provider; |
| 120 | 122 |
| 121 OnContentSettingChanged(ContentSettingsPattern(), | 123 OnContentSettingChanged(ContentSettingsPattern(), |
| 122 ContentSettingsPattern(), | 124 ContentSettingsPattern(), |
| 123 CONTENT_SETTINGS_TYPE_DEFAULT, | 125 CONTENT_SETTINGS_TYPE_DEFAULT, |
| 124 ""); | 126 ""); |
| 125 } | 127 } |
| 126 | 128 |
| 127 // static | 129 // static |
| 128 void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { | 130 void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { |
| 129 prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, | 131 prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 } | 556 } |
| 555 } | 557 } |
| 556 | 558 |
| 557 if (info) { | 559 if (info) { |
| 558 info->source = content_settings::SETTING_SOURCE_NONE; | 560 info->source = content_settings::SETTING_SOURCE_NONE; |
| 559 info->primary_pattern = ContentSettingsPattern(); | 561 info->primary_pattern = ContentSettingsPattern(); |
| 560 info->secondary_pattern = ContentSettingsPattern(); | 562 info->secondary_pattern = ContentSettingsPattern(); |
| 561 } | 563 } |
| 562 return NULL; | 564 return NULL; |
| 563 } | 565 } |
| OLD | NEW |