Chromium Code Reviews| 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..32fdcaa1428a8d8aa5ccbe3d39d6ef53c06809d3 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,37 @@ using extensions::UnloadedExtensionInfo; |
| namespace content_settings { |
| +namespace { |
| + |
| +const char* kRemotingViewerWhitelist[] = { |
| + "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop |
|
Bernhard Bauer
2014/12/12 14:44:37
I never know how whether these initializer lists a
|
| + "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); |
| + |
| + // Allow the Chrome Remote Desktop extension to load its internal plugin. |
|
Bernhard Bauer
2014/12/12 14:44:37
This seems like it could be extracted into a helpe
|
| + if (chrome_remote_desktop_.find(extension.get()->id()) != |
| + chrome_remote_desktop_.end()) { |
| + SetContentSettingForExtensionAndResource( |
| + extension.get(), ChromeContentClient::kRemotingViewerPluginPath, |
| + CONTENT_SETTING_ALLOW); |
| + } |
| } |
| registrar_->Add(this, |
| extensions::NOTIFICATION_EXTENSION_HOST_CREATED, |
| @@ -137,6 +161,14 @@ void InternalExtensionProvider::Observe(int type, |
| content::Details<extensions::Extension>(details).ptr(); |
| if (extensions::PluginInfo::HasPlugins(extension)) |
| SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); |
| + |
| + // Allow the Chrome Remote Desktop extension to load its internal plugin. |
| + if (chrome_remote_desktop_.find(extension->id()) != |
| + chrome_remote_desktop_.end()) { |
| + SetContentSettingForExtensionAndResource( |
| + extension, ChromeContentClient::kRemotingViewerPluginPath, |
| + CONTENT_SETTING_ALLOW); |
| + } |
| break; |
| } |
| case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| @@ -144,6 +176,13 @@ void InternalExtensionProvider::Observe(int type, |
| *(content::Details<UnloadedExtensionInfo>(details).ptr()); |
| if (extensions::PluginInfo::HasPlugins(info.extension)) |
| SetContentSettingForExtension(info.extension, CONTENT_SETTING_DEFAULT); |
| + |
| + if (chrome_remote_desktop_.find(info.extension->id()) != |
| + chrome_remote_desktop_.end()) { |
| + SetContentSettingForExtensionAndResource( |
| + info.extension, ChromeContentClient::kRemotingViewerPluginPath, |
| + CONTENT_SETTING_DEFAULT); |
| + } |
| break; |
| } |
| default: |