| Index: chrome/browser/extensions/unpacked_installer.cc
|
| diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
|
| index f812a2f5f368e2391f6404ffb8128699c844337f..988293d951b887b6b6b1308bd7aaec09155e0c6f 100644
|
| --- a/chrome/browser/extensions/unpacked_installer.cc
|
| +++ b/chrome/browser/extensions/unpacked_installer.cc
|
| @@ -40,6 +40,10 @@ namespace {
|
| const char kUnpackedExtensionsBlacklistedError[] =
|
| "Loading of unpacked extensions is disabled by the administrator.";
|
|
|
| +const char kUnpackedExtensionInsteadOfAppError[] =
|
| + "App loading flags cannot be used to load extensions. Please use "
|
| + "--load-extension instead.";
|
| +
|
| const char kImportMinVersionNewer[] =
|
| "'import' version requested is newer than what is installed.";
|
| const char kImportMissing[] = "'import' extension is not installed.";
|
| @@ -130,7 +134,8 @@ void UnpackedInstaller::Load(const base::FilePath& path_in) {
|
| }
|
|
|
| bool UnpackedInstaller::LoadFromCommandLine(const base::FilePath& path_in,
|
| - std::string* extension_id) {
|
| + std::string* extension_id,
|
| + bool only_allow_apps) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| DCHECK(extension_path_.empty());
|
|
|
| @@ -152,6 +157,16 @@ bool UnpackedInstaller::LoadFromCommandLine(const base::FilePath& path_in,
|
| file_util::LoadExtension(
|
| extension_path_, Manifest::COMMAND_LINE, GetFlags(), &error).get());
|
|
|
| + if (only_allow_apps && !extension()->is_platform_app()) {
|
| +#if defined(GOOGLE_CHROME_BUILD)
|
| + // Avoid crashing for users with hijacked shortcuts.
|
| + return true;
|
| +#else
|
| + ReportExtensionLoadError(kUnpackedExtensionInsteadOfAppError);
|
| + return false;
|
| +#endif
|
| + }
|
| +
|
| if (!extension() ||
|
| !extension_l10n_util::ValidateExtensionLocales(
|
| extension_path_, extension()->manifest()->value(), &error)) {
|
|
|