Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1012)

Unified Diff: chrome/browser/content_settings/content_settings_internal_extension_provider.cc

Issue 794903005: Whiltelist the remoting viewer for the Chromoting extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/content_settings/content_settings_internal_extension_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5236c20c7ad9b607556f4cd0ec3d48df90d9e796 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,21 @@ void InternalExtensionProvider::ShutdownOnUIThread() {
registrar_.reset();
}
+void InternalExtensionProvider::ApplyPluginContentSettingsForExtension(
+ const extensions::Extension* extension,
+ ContentSetting setting) {
+ if (extensions::PluginInfo::HasPlugins(extension))
+ SetContentSettingForExtension(extension, setting);
+
+ // Chrome Remove Desktop relies on the remoting viewer plugin. The
+ // above check does not catch this, as the plugin is a builtin plugin.
+ if (chrome_remote_desktop_.find(extension->id()) !=
+ chrome_remote_desktop_.end()) {
+ SetContentSettingForExtensionAndResource(
+ extension, ChromeContentClient::kRemotingViewerPluginPath, setting);
+ }
+}
+
void InternalExtensionProvider::SetContentSettingForExtension(
const extensions::Extension* extension,
ContentSetting setting) {
« no previous file with comments | « chrome/browser/content_settings/content_settings_internal_extension_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698