Chromium Code Reviews| Index: chrome/common/extensions/extension.cc |
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc |
| index f042c988ef4d6158bd44f2c49a9bb95d9b5d4642..b5389bd036b965d76484a2a03672618059799ad7 100644 |
| --- a/chrome/common/extensions/extension.cc |
| +++ b/chrome/common/extensions/extension.cc |
| @@ -1498,6 +1498,10 @@ bool Extension::LoadCommands(string16* error) { |
| bool Extension::LoadPlugins(string16* error) { |
| if (!manifest_->HasKey(keys::kPlugins)) |
| return true; |
| + |
| + // If the extension has NPAPI plugins then by default assume it needs them. |
| + requirements_.npapi = true; |
|
Aaron Boodman
2012/09/19 21:34:52
Why did you move this from LoadRequirements()? I t
Wez
2012/09/21 00:13:56
The existing code was setting this value based on
Aaron Boodman
2012/09/21 02:33:08
I see. I mean, you could just check manifest->HasK
Wez
2012/09/22 07:21:00
OK, you've convinced me. Moved.
|
| + |
| ListValue* list_value = NULL; |
| if (!manifest_->GetList(keys::kPlugins, &list_value)) { |
| *error = ASCIIToUTF16(errors::kInvalidPlugins); |
| @@ -1528,24 +1532,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; |
| } |
| @@ -1673,10 +1673,6 @@ 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; |
| - |
| if (!manifest_->HasKey(keys::kRequirements)) |
| return true; |