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

Unified Diff: chrome/browser/extensions/unpacked_installer.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, 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/extensions/unpacked_installer.cc
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
index 6d4946cc13b455551bcf0e87fce67be7439b1ec0..a560457efa2aff707b6a9c8c3de3d551e1d3a3bc 100644
--- a/chrome/browser/extensions/unpacked_installer.cc
+++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "base/file_util.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
@@ -164,6 +165,34 @@ bool UnpackedInstaller::LoadFromCommandLine(const base::FilePath& path_in,
return true;
}
+void UnpackedInstaller::LoadFromZipFile(const base::FilePath& zip_path) {
+ scoped_refptr<SandboxedUnpacker> unpacker(new SandboxedUnpacker(
+ zip_path,
+ Manifest::UNPACKED,
+ 0,
+ base::FilePath(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
+ this));
+
+ BrowserThread::PostTask(
+ BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&SandboxedUnpacker::Start, unpacker.get()));
+}
+
+void UnpackedInstaller::OnUnpackSuccess(
+ const base::FilePath& temp_dir,
+ const base::FilePath& extension_root,
+ const base::DictionaryValue* original_manifest,
+ const Extension* extension,
+ const SkBitmap& install_icon) {
+ Load(extension_root);
+}
+
+void UnpackedInstaller::OnUnpackFailure(const base::string16& error) {
+ ReportExtensionLoadError(base::UTF16ToUTF8(error));
+}
+
void UnpackedInstaller::ShowInstallPrompt() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!service_weak_.get())

Powered by Google App Engine
This is Rietveld 408576698