Index: chrome/browser/content_settings/content_settings_internal_extension_provider.cc |
diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc |
index 68d970bce34b548db5d8bcdcf54a098120306248..d34e612c9d9c2e90fd630b1ceb2e081322b99667 100644 |
--- a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc |
+++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc |
@@ -24,13 +24,30 @@ using extensions::UnloadedExtensionInfo; |
namespace content_settings { |
+namespace { |
+ |
+// This is the set of extensions that are allowed to access the internal |
+// remoting viewer plugin. |
+const char* kRemotingViewerWhitelist[] = { |
+ "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop |
+ "kgngmbheleoaphbjbaiobfdepmghbfah", // Pre-release Chrome Remote Desktop |
+ "odkaodonbgfohohmklejpjiejmcipmib", // Dogfood Chrome Remote Desktop |
+ "ojoimpklfciegopdfgeenehpalipignm", // Chromoting canary |
+}; |
+ |
+} // namespace |
+ |
+ |
InternalExtensionProvider::InternalExtensionProvider(Profile* profile) |
: registrar_(new content::NotificationRegistrar) { |
+ for (size_t i = 0; i < arraysize(kRemotingViewerWhitelist); ++i) |
+ chrome_remote_desktop_.insert(kRemotingViewerWhitelist[i]); |
+ |
// Whitelist all extensions loaded so far. |
for (const scoped_refptr<const extensions::Extension>& extension : |
extensions::ExtensionRegistry::Get(profile)->enabled_extensions()) { |
- if (extensions::PluginInfo::HasPlugins(extension.get())) |
- SetContentSettingForExtension(extension.get(), CONTENT_SETTING_ALLOW); |
+ ApplyPluginContentSettingsForExtension(extension.get(), |
+ CONTENT_SETTING_ALLOW); |
} |
registrar_->Add(this, |
extensions::NOTIFICATION_EXTENSION_HOST_CREATED, |
@@ -135,15 +152,14 @@ void InternalExtensionProvider::Observe(int type, |
case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
const extensions::Extension* extension = |
content::Details<extensions::Extension>(details).ptr(); |
- if (extensions::PluginInfo::HasPlugins(extension)) |
- SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); |
+ ApplyPluginContentSettingsForExtension(extension, CONTENT_SETTING_ALLOW); |
break; |
} |
case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
const UnloadedExtensionInfo& info = |
*(content::Details<UnloadedExtensionInfo>(details).ptr()); |
- if (extensions::PluginInfo::HasPlugins(info.extension)) |
- SetContentSettingForExtension(info.extension, CONTENT_SETTING_DEFAULT); |
+ ApplyPluginContentSettingsForExtension(info.extension, |
+ CONTENT_SETTING_DEFAULT); |
break; |
} |
default: |
@@ -157,6 +173,19 @@ void InternalExtensionProvider::ShutdownOnUIThread() { |
registrar_.reset(); |
} |
+void InternalExtensionProvider::ApplyPluginContentSettingsForExtension( |
+ const extensions::Extension* extension, |
+ ContentSetting setting) { |
+ if (extensions::PluginInfo::HasPlugins(extension)) |
+ SetContentSettingForExtension(extension, setting); |
+ |
+ if (chrome_remote_desktop_.find(extension->id()) != |
Bernhard Bauer
2014/12/12 15:00:46
Add a comment that explains the stuff from the CL
|
+ chrome_remote_desktop_.end()) { |
+ SetContentSettingForExtensionAndResource( |
+ extension, ChromeContentClient::kRemotingViewerPluginPath, setting); |
+ } |
+} |
+ |
void InternalExtensionProvider::SetContentSettingForExtension( |
const extensions::Extension* extension, |
ContentSetting setting) { |