| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/content_settings_internal_extension_pr
ovider.h" | 5 #include "chrome/browser/content_settings/content_settings_internal_extension_pr
ovider.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/content_settings/content_settings_rule.h" | 8 #include "chrome/browser/content_settings/content_settings_rule.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 32 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 33 it != extensions->end(); ++it) { | 33 it != extensions->end(); ++it) { |
| 34 if (extensions::PluginInfo::HasPlugins(it->get())) | 34 if (extensions::PluginInfo::HasPlugins(it->get())) |
| 35 SetContentSettingForExtension(it->get(), CONTENT_SETTING_ALLOW); | 35 SetContentSettingForExtension(it->get(), CONTENT_SETTING_ALLOW); |
| 36 } | 36 } |
| 37 Profile* profile = extension_service->profile(); | 37 Profile* profile = extension_service->profile(); |
| 38 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 38 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 39 content::Source<Profile>(profile)); | 39 content::Source<Profile>(profile)); |
| 40 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 40 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 41 content::Source<Profile>(profile)); | 41 content::Source<Profile>(profile)); |
| 42 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 42 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 43 content::Source<Profile>(profile)); | 43 content::Source<Profile>(profile)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 InternalExtensionProvider::~InternalExtensionProvider() { | 46 InternalExtensionProvider::~InternalExtensionProvider() { |
| 47 DCHECK(!registrar_.get()); | 47 DCHECK(!registrar_.get()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 RuleIterator* InternalExtensionProvider::GetRuleIterator( | 50 RuleIterator* InternalExtensionProvider::GetRuleIterator( |
| 51 ContentSettingsType content_type, | 51 ContentSettingsType content_type, |
| 52 const ResourceIdentifier& resource_identifier, | 52 const ResourceIdentifier& resource_identifier, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 break; | 100 break; |
| 101 } | 101 } |
| 102 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 102 case chrome::NOTIFICATION_EXTENSION_LOADED: { |
| 103 const extensions::Extension* extension = | 103 const extensions::Extension* extension = |
| 104 content::Details<extensions::Extension>(details).ptr(); | 104 content::Details<extensions::Extension>(details).ptr(); |
| 105 if (extensions::PluginInfo::HasPlugins(extension)) | 105 if (extensions::PluginInfo::HasPlugins(extension)) |
| 106 SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); | 106 SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); |
| 107 break; | 107 break; |
| 108 } | 108 } |
| 109 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 109 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 110 const UnloadedExtensionInfo& info = | 110 const UnloadedExtensionInfo& info = |
| 111 *(content::Details<UnloadedExtensionInfo>(details).ptr()); | 111 *(content::Details<UnloadedExtensionInfo>(details).ptr()); |
| 112 if (extensions::PluginInfo::HasPlugins(info.extension)) | 112 if (extensions::PluginInfo::HasPlugins(info.extension)) |
| 113 SetContentSettingForExtension(info.extension, CONTENT_SETTING_DEFAULT); | 113 SetContentSettingForExtension(info.extension, CONTENT_SETTING_DEFAULT); |
| 114 break; | 114 break; |
| 115 } | 115 } |
| 116 default: | 116 default: |
| 117 NOTREACHED(); | 117 NOTREACHED(); |
| 118 } | 118 } |
| 119 } | 119 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 base::Value::CreateIntegerValue(setting)); | 158 base::Value::CreateIntegerValue(setting)); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 NotifyObservers(primary_pattern, | 161 NotifyObservers(primary_pattern, |
| 162 secondary_pattern, | 162 secondary_pattern, |
| 163 CONTENT_SETTINGS_TYPE_PLUGINS, | 163 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 164 resource); | 164 resource); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace content_settings | 167 } // namespace content_settings |
| OLD | NEW |