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

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: rebase Created 6 years, 4 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 4f8754341e2a1270d583552be2a8bc5c8d6fde45..72906fca61ae58936ee741f4ad72a20e1ee6faa1 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(
@@ -290,7 +304,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)));
Devlin 2014/08/11 15:58:01 This looks like a merge conflict resolution gone w
failure->Set("manifest", manifest_value.release());
failures_.Append(failure.release());
« no previous file with comments | « chrome/browser/resources/extensions/extensions.js ('k') | chrome/browser/ui/webui/extensions/install_extension_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698