summaryrefslogtreecommitdiffstats
path: root/chrome/utility
diff options
context:
space:
mode:
authorelijahtaylor@chromium.org <elijahtaylor@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-09 08:51:39 +0000
committerelijahtaylor@chromium.org <elijahtaylor@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-09 08:52:56 +0000
commit79141acdf19dcd33bc5cf3de516c6ed3bffc8994 (patch)
treeaa7bb366e66c0d819e27784ba23e8b735701f13c /chrome/utility
parent5634ac560d1b61123d1b8dfb6660172d61187ffb (diff)
downloadchromium_src-79141acdf19dcd33bc5cf3de516c6ed3bffc8994.zip
chromium_src-79141acdf19dcd33bc5cf3de516c6ed3bffc8994.tar.gz
chromium_src-79141acdf19dcd33bc5cf3de516c6ed3bffc8994.tar.bz2
Allow drag-and-drop of zipped extensions on chrome://extensions
TEST=drag zip file extension to chrome://extensions BUG=395311 Review URL: https://codereview.chromium.org/406713002 Cr-Commit-Position: refs/heads/master@{#288545} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility')
-rw-r--r--chrome/utility/extensions/extensions_handler.cc17
-rw-r--r--chrome/utility/extensions/extensions_handler.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/chrome/utility/extensions/extensions_handler.cc b/chrome/utility/extensions/extensions_handler.cc
index 6aa0c2e..25f65a7 100644
--- a/chrome/utility/extensions/extensions_handler.cc
+++ b/chrome/utility/extensions/extensions_handler.cc
@@ -21,6 +21,7 @@
#include "extensions/common/update_manifest.h"
#include "media/base/media.h"
#include "media/base/media_file_checker.h"
+#include "third_party/zlib/google/zip.h"
#include "ui/base/ui_base_switches.h"
#if defined(OS_WIN)
@@ -52,6 +53,9 @@ void ReleaseProcessIfNeeded() {
content::UtilityThread::Get()->ReleaseProcessIfNeeded();
}
+const char kExtensionHandlerUnzipError[] =
+ "Could not unzip extension for install.";
+
} // namespace
ExtensionsHandler::ExtensionsHandler() {}
@@ -81,6 +85,7 @@ bool ExtensionsHandler::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ExtensionsHandler, message)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_UnpackExtension, OnUnpackExtension)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_UnzipToDir, OnUnzipToDir)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseUpdateManifest,
OnParseUpdateManifest)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageBase64, OnDecodeImageBase64)
@@ -139,6 +144,18 @@ void ExtensionsHandler::OnUnpackExtension(
ReleaseProcessIfNeeded();
}
+void ExtensionsHandler::OnUnzipToDir(const base::FilePath& zip_path,
+ const base::FilePath& dir) {
+ if (!zip::Unzip(zip_path, dir)) {
+ Send(new ChromeUtilityHostMsg_UnzipToDir_Failed(
+ std::string(kExtensionHandlerUnzipError)));
+ } else {
+ Send(new ChromeUtilityHostMsg_UnzipToDir_Succeeded(dir));
+ }
+
+ ReleaseProcessIfNeeded();
+}
+
void ExtensionsHandler::OnParseUpdateManifest(const std::string& xml) {
UpdateManifest manifest;
if (!manifest.Parse(xml)) {
diff --git a/chrome/utility/extensions/extensions_handler.h b/chrome/utility/extensions/extensions_handler.h
index 3fc732b..bc06a100 100644
--- a/chrome/utility/extensions/extensions_handler.h
+++ b/chrome/utility/extensions/extensions_handler.h
@@ -39,6 +39,7 @@ class ExtensionsHandler : public UtilityMessageHandler {
void OnUnpackExtension(const base::FilePath& extension_path,
const std::string& extension_id,
int location, int creation_flags);
+ void OnUnzipToDir(const base::FilePath& zip_path, const base::FilePath& dir);
void OnParseUpdateManifest(const std::string& xml);
void OnDecodeImageBase64(const std::string& encoded_data);
void OnParseJSON(const std::string& json);