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

Unified Diff: chrome/browser/ui/webui/extensions/extension_loader_handler.cc

Issue 406713002: Allow drag-and-drop of zipped extensions on chrome://extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add zipfile installer Created 6 years, 5 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/browser/ui/webui/extensions/extension_loader_handler.cc
diff --git a/chrome/browser/ui/webui/extensions/extension_loader_handler.cc b/chrome/browser/ui/webui/extensions/extension_loader_handler.cc
index 0bc5aa96a702bb9b93f1828ccea8933660256001..f671ce90b7387915e18171e03cb9f1482d785282 100644
--- a/chrome/browser/ui/webui/extensions/extension_loader_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_loader_handler.cc
@@ -14,6 +14,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/path_util.h"
#include "chrome/browser/extensions/unpacked_installer.h"
+#include "chrome/browser/extensions/zipfile_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "content/public/browser/browser_thread.h"
@@ -218,14 +219,27 @@ void ExtensionLoaderHandler::HandleDisplayFailures(
void ExtensionLoaderHandler::LoadUnpackedExtensionImpl(
const base::FilePath& file_path) {
- scoped_refptr<UnpackedInstaller> installer = UnpackedInstaller::Create(
- ExtensionSystem::Get(profile_)->extension_service());
-
- // We do our own error handling, so we don't want a load failure to trigger
- // a dialog.
- installer->set_be_noisy_on_failure(false);
-
- installer->Load(file_path);
+ if (EndsWith(file_path.AsUTF16Unsafe(),
+ base::ASCIIToUTF16(".zip"),
+ false /* case insensitive */)) {
+ scoped_refptr<ZipFileInstaller> installer = ZipFileInstaller::Create(
+ ExtensionSystem::Get(profile_)->extension_service());
+
+ // We do our own error handling, so we don't want a load failure to trigger
+ // a dialog.
+ installer->set_be_noisy_on_failure(false);
+
+ installer->LoadFromZipFile(file_path);
+ } else {
+ scoped_refptr<UnpackedInstaller> installer = UnpackedInstaller::Create(
+ ExtensionSystem::Get(profile_)->extension_service());
+
+ // We do our own error handling, so we don't want a load failure to trigger
+ // a dialog.
+ installer->set_be_noisy_on_failure(false);
+
+ installer->Load(file_path);
+ }
}
void ExtensionLoaderHandler::OnLoadFailure(const base::FilePath& file_path,
@@ -284,7 +298,7 @@ void ExtensionLoaderHandler::AddFailure(
scoped_ptr<base::DictionaryValue> failure(new base::DictionaryValue());
failure->Set("path",
new base::StringValue(prettified_path.LossyDisplayName()));
- failure->Set("error", new base::StringValue(base::UTF8ToUTF16(error)));
+ failure->Set("reason", new base::StringValue(base::UTF8ToUTF16(error)));
elijahtaylor1 2014/07/31 17:26:28 this is a bug fix for the unpacked extension loade
failure->Set("manifest", manifest_value.release());
failures_.Append(failure.release());

Powered by Google App Engine
This is Rietveld 408576698