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

Unified Diff: chrome/common/extensions/extension.cc

Issue 10949017: Allow extensions which can run without NPAPI to run under Windows 8 Metro. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch cross-origin-XHR all-URLs test for ChromeOS. Created 8 years, 3 months 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
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index ecdbcf38c785223527318e1b66a148a468eeddd4..57c176fa8af4bb81e5e00e60a8f9181deb786463 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1513,6 +1513,7 @@ bool Extension::LoadCommands(string16* error) {
bool Extension::LoadPlugins(string16* error) {
if (!manifest_->HasKey(keys::kPlugins))
return true;
+
ListValue* list_value = NULL;
if (!manifest_->GetList(keys::kPlugins, &list_value)) {
*error = ASCIIToUTF16(errors::kInvalidPlugins);
@@ -1543,24 +1544,20 @@ bool Extension::LoadPlugins(string16* error) {
}
}
+ // We don't allow extensions to load NPAPI plugins on Chrome OS, or under
+ // Windows 8 Metro mode, but still parse the entries to display consistent
+ // error messages. If the extension actually requires the plugins then
+ // LoadRequirements will prevent it loading.
#if defined(OS_CHROMEOS)
- // We don't allow extension plugins to run on Chrome OS. We still
- // parse the manifest entry so that error messages are consistently
- // displayed across platforms.
-#else
-#if defined(OS_WIN)
- // Like Chrome OS, we don't support NPAPI plugins in Windows 8 metro mode
- // but in this case we want to fail with an error.
+ continue;
+#elif defined(OS_WIN)
if (base::win::IsMetroProcess()) {
- *error = l10n_util::GetStringUTF16(
- IDS_EXTENSION_INSTALL_PLUGIN_NOT_SUPPORTED);
- return false;
+ continue;
}
#endif // defined(OS_WIN).
plugins_.push_back(PluginInfo());
plugins_.back().path = path().Append(FilePath::FromUTF8Unsafe(path_str));
plugins_.back().is_public = is_public;
-#endif // defined(OS_CHROMEOS).
}
return true;
}
@@ -1688,9 +1685,11 @@ bool Extension::LoadSandboxedPages(string16* error) {
}
bool Extension::LoadRequirements(string16* error) {
- // If the extension has plugins, then |requirements_.npapi| defaults to true.
- if (plugins_.size() > 0)
- requirements_.npapi = true;
+ // Before parsing requirements from the manifest, automatically default the
+ // NPAPI plugin requirement based on whether it includes NPAPI plugins.
+ ListValue* list_value = NULL;
+ requirements_.npapi =
+ manifest_->GetList(keys::kPlugins, &list_value) && !list_value->empty();
if (!manifest_->HasKey(keys::kRequirements))
return true;

Powered by Google App Engine
This is Rietveld 408576698