| 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_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/common/chrome_content_client.h" | 10 #include "chrome/common/chrome_content_client.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // Whitelist all extensions loaded so far. | 30 // Whitelist all extensions loaded so far. |
| 31 const extensions::ExtensionSet* extensions = extension_service->extensions(); | 31 const extensions::ExtensionSet* extensions = extension_service->extensions(); |
| 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, |
| 41 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 41 content::Source<Profile>(profile)); | 42 content::Source<Profile>(profile)); |
| 42 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 43 registrar_->Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 43 content::Source<Profile>(profile)); | 44 content::Source<Profile>(profile)); |
| 44 } | 45 } |
| 45 | 46 |
| 46 InternalExtensionProvider::~InternalExtensionProvider() { | 47 InternalExtensionProvider::~InternalExtensionProvider() { |
| 47 DCHECK(!registrar_.get()); | 48 DCHECK(!registrar_.get()); |
| 48 } | 49 } |
| 49 | 50 |
| 50 RuleIterator* InternalExtensionProvider::GetRuleIterator( | 51 RuleIterator* InternalExtensionProvider::GetRuleIterator( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 kAppWhitelist, kAppWhitelist + arraysize(kAppWhitelist)))) { | 114 kAppWhitelist, kAppWhitelist + arraysize(kAppWhitelist)))) { |
| 114 SetContentSettingForExtensionAndResource( | 115 SetContentSettingForExtensionAndResource( |
| 115 host->extension(), | 116 host->extension(), |
| 116 ChromeContentClient::kRemotingViewerPluginPath, | 117 ChromeContentClient::kRemotingViewerPluginPath, |
| 117 CONTENT_SETTING_ALLOW); | 118 CONTENT_SETTING_ALLOW); |
| 118 } | 119 } |
| 119 } | 120 } |
| 120 | 121 |
| 121 break; | 122 break; |
| 122 } | 123 } |
| 123 case chrome::NOTIFICATION_EXTENSION_LOADED: { | 124 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| 124 const extensions::Extension* extension = | 125 const extensions::Extension* extension = |
| 125 content::Details<extensions::Extension>(details).ptr(); | 126 content::Details<extensions::Extension>(details).ptr(); |
| 126 if (extensions::PluginInfo::HasPlugins(extension)) | 127 if (extensions::PluginInfo::HasPlugins(extension)) |
| 127 SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); | 128 SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); |
| 128 break; | 129 break; |
| 129 } | 130 } |
| 130 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { | 131 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| 131 const UnloadedExtensionInfo& info = | 132 const UnloadedExtensionInfo& info = |
| 132 *(content::Details<UnloadedExtensionInfo>(details).ptr()); | 133 *(content::Details<UnloadedExtensionInfo>(details).ptr()); |
| 133 if (extensions::PluginInfo::HasPlugins(info.extension)) | 134 if (extensions::PluginInfo::HasPlugins(info.extension)) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 base::Value::CreateIntegerValue(setting)); | 180 base::Value::CreateIntegerValue(setting)); |
| 180 } | 181 } |
| 181 } | 182 } |
| 182 NotifyObservers(primary_pattern, | 183 NotifyObservers(primary_pattern, |
| 183 secondary_pattern, | 184 secondary_pattern, |
| 184 CONTENT_SETTINGS_TYPE_PLUGINS, | 185 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 185 resource); | 186 resource); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace content_settings | 189 } // namespace content_settings |
| OLD | NEW |