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

Unified Diff: chrome/browser/ui/webui/extensions/install_extension_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/install_extension_handler.cc
diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.cc b/chrome/browser/ui/webui/extensions/install_extension_handler.cc
index b0770b8c1e1317bd5427dbe182cf0d36c4e9feef..b54dafca5576bcbae71c1b6c8062283347485717 100644
--- a/chrome/browser/ui/webui/extensions/install_extension_handler.cc
+++ b/chrome/browser/ui/webui/extensions/install_extension_handler.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/unpacked_installer.h"
+#include "chrome/browser/extensions/zipfile_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
@@ -99,30 +100,35 @@ void InstallExtensionHandler::HandleInstallMessage(
Profile* profile = Profile::FromBrowserContext(
web_ui()->GetWebContents()->GetBrowserContext());
- scoped_ptr<ExtensionInstallPrompt> prompt(
- new ExtensionInstallPrompt(web_ui()->GetWebContents()));
- scoped_refptr<CrxInstaller> crx_installer(CrxInstaller::Create(
- ExtensionSystem::Get(profile)->extension_service(),
- prompt.Pass()));
- crx_installer->set_error_on_unsupported_requirements(true);
- crx_installer->set_off_store_install_allow_reason(
- CrxInstaller::OffStoreInstallAllowedFromSettingsPage);
- crx_installer->set_install_immediately(true);
const bool kCaseSensitive = false;
- if (EndsWith(file_display_name_,
- base::ASCIIToUTF16(".user.js"),
- kCaseSensitive)) {
- crx_installer->InstallUserScript(
- file_to_install_,
- net::FilePathToFileURL(file_to_install_));
- } else if (EndsWith(file_display_name_,
- base::ASCIIToUTF16(".crx"),
- kCaseSensitive)) {
- crx_installer->InstallCrx(file_to_install_);
+ if (EndsWith(
+ file_display_name_, base::ASCIIToUTF16(".zip"), kCaseSensitive)) {
+ ZipFileInstaller::Create(ExtensionSystem::Get(profile)->extension_service())
+ ->LoadFromZipFile(file_to_install_);
} else {
- CHECK(false);
+ scoped_ptr<ExtensionInstallPrompt> prompt(
+ new ExtensionInstallPrompt(web_ui()->GetWebContents()));
+ scoped_refptr<CrxInstaller> crx_installer(CrxInstaller::Create(
+ ExtensionSystem::Get(profile)->extension_service(), prompt.Pass()));
+ crx_installer->set_error_on_unsupported_requirements(true);
+ crx_installer->set_off_store_install_allow_reason(
+ CrxInstaller::OffStoreInstallAllowedFromSettingsPage);
+ crx_installer->set_install_immediately(true);
+
+ if (EndsWith(file_display_name_,
+ base::ASCIIToUTF16(".user.js"),
+ kCaseSensitive)) {
+ crx_installer->InstallUserScript(
+ file_to_install_, net::FilePathToFileURL(file_to_install_));
+ } else if (EndsWith(file_display_name_,
+ base::ASCIIToUTF16(".crx"),
+ kCaseSensitive)) {
+ crx_installer->InstallCrx(file_to_install_);
+ } else {
+ CHECK(false);
+ }
}
file_to_install_.clear();

Powered by Google App Engine
This is Rietveld 408576698