summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-05 03:25:28 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-05 03:25:28 +0000
commiteb14d66f3c8a9a1ee3e829d1464747a2327f4e2a (patch)
tree899fafe45440ad011f0bc291b5848e30c8275ebe
parent0f141c74d341a53e9b723e1d631ba7c29d6d5ccb (diff)
downloadchromium_src-eb14d66f3c8a9a1ee3e829d1464747a2327f4e2a.zip
chromium_src-eb14d66f3c8a9a1ee3e829d1464747a2327f4e2a.tar.gz
chromium_src-eb14d66f3c8a9a1ee3e829d1464747a2327f4e2a.tar.bz2
Revert 135525 - Add a first-class off-store install UI to chrome://extensions/.
This patch implements GTK only. Other ports will be separate CLs. BUG=55584 Review URL: https://chromiumcodereview.appspot.com/10270031 TBR=aa@chromium.org Review URL: https://chromiumcodereview.appspot.com/10382025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135528 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/browser/resources/extensions/extensions.css10
-rw-r--r--chrome/browser/resources/extensions/extensions.html3
-rw-r--r--chrome/browser/resources/extensions/extensions.js47
-rw-r--r--chrome/browser/ui/webui/extensions/extensions_ui.cc9
-rw-r--r--chrome/browser/ui/webui/extensions/install_extension_handler.cc88
-rw-r--r--chrome/browser/ui/webui/extensions/install_extension_handler.h48
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.cc4
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.h1
-rw-r--r--content/browser/web_contents/web_drag_dest_gtk.h2
-rw-r--r--content/public/browser/web_contents_view.h5
-rw-r--r--content/test/test_web_contents_view.cc4
-rw-r--r--content/test/test_web_contents_view.h1
14 files changed, 3 insertions, 224 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 4af3d95..98f953e 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4525,9 +4525,6 @@ Update checks have repeatedly failed for the extension "<ph name="EXTENSION_NAME
<message name="IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY" desc="Text on next line after IDS_EXTENSIONS_NONE_INSTALLED that suggests the user look in the gallery for extensions to install.">
Want to <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>browse the gallery<ph name="END_LINK">&lt;/a&gt;</ph> instead?
</message>
- <message name="IDS_EXTENSIONS_INSTALL_DROP_TARGET" desc="Text on drop target for installing extensions.">
- Drop to install
- </message>
<message name="IDS_EXTENSIONS_CRASHED_EXTENSION" desc="Text that signifies that the extension process was terminated, usually because it has crashed.">
(Crashed)
</message>
diff --git a/chrome/browser/resources/extensions/extensions.css b/chrome/browser/resources/extensions/extensions.css
index ff7164b..ee9ec52 100644
--- a/chrome/browser/resources/extensions/extensions.css
+++ b/chrome/browser/resources/extensions/extensions.css
@@ -204,16 +204,6 @@ html[dir='rtl'] .extension-list-item {
display: none;
}
-#dropTargetOverlay {
- color: rgb(48, 57, 66);
- font-size: 18px;
- text-align: center;
-}
-
-#dropTargetOverlay div {
- margin: 1em;
-}
-
/* Trash */
#extension-settings .trash {
diff --git a/chrome/browser/resources/extensions/extensions.html b/chrome/browser/resources/extensions/extensions.html
index 763b98a..e9386d9 100644
--- a/chrome/browser/resources/extensions/extensions.html
+++ b/chrome/browser/resources/extensions/extensions.html
@@ -28,9 +28,6 @@
<div id="overlay" class="overlay" hidden>
<include src="pack_extension_overlay.html">
<include src="../shared/html/alert_overlay.html">
- <div id="dropTargetOverlay" class="page">
- <div i18n-content="extensionSettingsInstallDropTarget"></div>
- </div>
</div>
<div class="page" id="extension-settings">
diff --git a/chrome/browser/resources/extensions/extensions.js b/chrome/browser/resources/extensions/extensions.js
index aedeb4a..51f7c80 100644
--- a/chrome/browser/resources/extensions/extensions.js
+++ b/chrome/browser/resources/extensions/extensions.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-<include src="../shared/js/cr/ui/drag_wrapper.js"></include>
<include src="../uber/uber_utils.js"></include>
<include src="extension_list.js"></include>
<include src="pack_extension_overlay.js"></include>
@@ -14,45 +13,6 @@ var webui_responded_ = false;
cr.define('extensions', function() {
var ExtensionsList = options.ExtensionsList;
- // Implements the DragWrapper handler interface.
- var dragWrapperHandler = {
- // @inheritdoc
- shouldAcceptDrag: function(e) {
- // We can't access filenames during the 'dragenter' event, so we have to
- // wait until 'drop' to decide whether to do something with the file or
- // not.
- // See: http://www.w3.org/TR/2011/WD-html5-20110113/dnd.html#concept-dnd-p
- return e.dataTransfer.types.indexOf('Files') > -1;
- },
- // @inheritdoc
- doDragEnter: function() {
- chrome.send('startDrag');
- ExtensionSettings.showOverlay(null);
- ExtensionSettings.showOverlay($('dropTargetOverlay'));
- },
- // @inheritdoc
- doDragLeave: function() {
- ExtensionSettings.showOverlay(null);
- chrome.send('stopDrag');
- },
- // @inheritdoc
- doDragOver: function(e) {
- },
- // @inheritdoc
- doDrop: function(e) {
- // Only process files that look like extensions. Other files should
- // navigate the browser normally.
- if (!e.dataTransfer.files.length ||
- !/\.crx$/.test(e.dataTransfer.files[0].name)) {
- return;
- }
-
- chrome.send('installDroppedFile');
- ExtensionSettings.showOverlay(null);
- e.preventDefault();
- }
- };
-
/**
* ExtensionSettings class
* @class
@@ -93,15 +53,8 @@ cr.define('extensions', function() {
$('update-extensions-now').addEventListener('click',
this.handleUpdateExtensionNow_.bind(this));
- if (!loadTimeData.getBoolean('offStoreInstallEnabled')) {
- this.dragWrapper_ =
- new cr.ui.DragWrapper(document.body, dragWrapperHandler);
- }
-
var packExtensionOverlay = extensions.PackExtensionOverlay.getInstance();
packExtensionOverlay.initializePage();
-
- cr.ui.overlay.setupOverlay($('dropTargetOverlay'));
},
/**
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc
index 451e5ba..71c05b9 100644
--- a/chrome/browser/ui/webui/extensions/extensions_ui.cc
+++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -7,14 +7,16 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
-#include "chrome/browser/ui/webui/extensions/install_extension_handler.h"
#include "chrome/browser/ui/webui/extensions/pack_extension_handler.h"
#include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
#include "chrome/browser/ui/webui/shared_resources_data_source.h"
#include "chrome/common/url_constants.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "grit/browser_resources.h"
+using content::WebContents;
+
namespace {
ChromeWebUIDataSource* CreateExtensionsHTMLSource() {
@@ -44,11 +46,6 @@ ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
PackExtensionHandler* pack_handler = new PackExtensionHandler();
pack_handler->GetLocalizedValues(source->localized_strings());
web_ui->AddMessageHandler(pack_handler);
-
- InstallExtensionHandler* install_extension_handler =
- new InstallExtensionHandler();
- install_extension_handler->GetLocalizedValues(source->localized_strings());
- web_ui->AddMessageHandler(install_extension_handler);
}
ExtensionsUI::~ExtensionsUI() {
diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.cc b/chrome/browser/ui/webui/extensions/install_extension_handler.cc
deleted file mode 100644
index 042e31a..0000000
--- a/chrome/browser/ui/webui/extensions/install_extension_handler.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/extensions/install_extension_handler.h"
-
-#include "base/bind.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/extensions/crx_installer.h"
-#include "chrome/browser/extensions/extension_install_ui.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/extensions/extension_switch_utils.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "content/public/browser/web_ui.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "webkit/glue/webdropdata.h"
-
-InstallExtensionHandler::InstallExtensionHandler() {
-}
-
-InstallExtensionHandler::~InstallExtensionHandler() {
-}
-
-void InstallExtensionHandler::GetLocalizedValues(
- DictionaryValue* localized_strings) {
- DCHECK(localized_strings);
- localized_strings->SetString(
- "extensionSettingsInstallDropTarget",
- l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALL_DROP_TARGET));
- localized_strings->SetBoolean(
- "offStoreInstallEnabled",
- extensions::switch_utils::IsOffStoreInstallEnabled());
-}
-
-void InstallExtensionHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "startDrag",
- base::Bind(&InstallExtensionHandler::HandleStartDragMessage,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "stopDrag",
- base::Bind(&InstallExtensionHandler::HandleStopDragMessage,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "installDroppedFile",
- base::Bind(&InstallExtensionHandler::HandleInstallMessage,
- base::Unretained(this)));
-}
-
-void InstallExtensionHandler::HandleStartDragMessage(const ListValue* args) {
- WebDropData* drop_data = web_ui()->GetWebContents()->GetView()->GetDropData();
- if (!drop_data) {
- DLOG(ERROR) << "No current drop data.";
- return;
- }
-
- if (drop_data->filenames.empty()) {
- DLOG(ERROR) << "Current drop data contains no files.";
- return;
- }
-
- file_to_install_ = FilePath::FromWStringHack(
- UTF16ToWide(drop_data->filenames.front()));
-}
-
-void InstallExtensionHandler::HandleStopDragMessage(const ListValue* args) {
- file_to_install_.clear();
-}
-
-void InstallExtensionHandler::HandleInstallMessage(const ListValue* args) {
- if (file_to_install_.empty()) {
- LOG(ERROR) << "No file captured to install.";
- return;
- }
-
- Profile* profile = Profile::FromWebUI(web_ui());
- scoped_refptr<CrxInstaller> crx_installer(
- CrxInstaller::Create(
- ExtensionSystem::Get(profile)->extension_service(),
- new ExtensionInstallUI(profile)));
- crx_installer->InstallCrx(file_to_install_);
-
- file_to_install_.clear();
-}
diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.h b/chrome/browser/ui/webui/extensions/install_extension_handler.h
deleted file mode 100644
index 26aa349..0000000
--- a/chrome/browser/ui/webui/extensions/install_extension_handler.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_
-#define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_
-#pragma once
-
-#include "base/file_path.h"
-#include "base/values.h"
-#include "content/public/browser/web_ui_message_handler.h"
-
-// Handles installing an extension when its file is dragged onto the page.
-class InstallExtensionHandler : public content::WebUIMessageHandler {
- public:
- InstallExtensionHandler();
- virtual ~InstallExtensionHandler();
-
- void GetLocalizedValues(DictionaryValue* localized_strings);
-
- // WebUIMessageHandler implementation.
- virtual void RegisterMessages() OVERRIDE;
-
- private:
- // Handles a notification from the JavaScript that a drag has started. This is
- // needed so that we can capture the file being dragged. If we wait until
- // we receive a drop notification, the drop data in the browser process will
- // have already been destroyed.
- void HandleStartDragMessage(const ListValue* args);
-
- // Handles a notification from the JavaScript that a drag has stopped.
- void HandleStopDragMessage(const ListValue* args);
-
- // Handles a notification from the JavaScript to install the file currently
- // being dragged.
- //
- // IMPORTANT: We purposefully do not allow the JavaScript to specify the file
- // to be installed as a precaution against the extension management page
- // getting XSS'd.
- void HandleInstallMessage(const ListValue* args);
-
- // The extension that will be installed when HandleInstallMessage() is called.
- FilePath file_to_install_;
-
- DISALLOW_COPY_AND_ASSIGN(InstallExtensionHandler);
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_INSTALL_EXTENSION_HANDLER_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 9043658..b82c6b6 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3656,8 +3656,6 @@
'browser/ui/webui/extensions/extension_settings_handler.h',
'browser/ui/webui/extensions/extensions_ui.cc',
'browser/ui/webui/extensions/extensions_ui.h',
- 'browser/ui/webui/extensions/install_extension_handler.cc',
- 'browser/ui/webui/extensions/install_extension_handler.h',
'browser/ui/webui/extensions/pack_extension_handler.cc',
'browser/ui/webui/extensions/pack_extension_handler.h',
'browser/ui/webui/favicon_source.cc',
diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc
index 5000952..8c69194 100644
--- a/content/browser/web_contents/web_contents_view_gtk.cc
+++ b/content/browser/web_contents/web_contents_view_gtk.cc
@@ -239,10 +239,6 @@ bool WebContentsViewGtk::IsDoingDrag() const {
void WebContentsViewGtk::CancelDragAndCloseTab() {
}
-WebDropData* WebContentsViewGtk::GetDropData() const {
- return drag_dest_->current_drop_data();
-}
-
bool WebContentsViewGtk::IsEventTracking() const {
return false;
}
diff --git a/content/browser/web_contents/web_contents_view_gtk.h b/content/browser/web_contents/web_contents_view_gtk.h
index 101ed59..782898c 100644
--- a/content/browser/web_contents/web_contents_view_gtk.h
+++ b/content/browser/web_contents/web_contents_view_gtk.h
@@ -60,7 +60,6 @@ class CONTENT_EXPORT WebContentsViewGtk : public WebContentsView {
virtual void RestoreFocus() OVERRIDE;
virtual bool IsDoingDrag() const OVERRIDE;
virtual void CancelDragAndCloseTab() OVERRIDE;
- virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;
diff --git a/content/browser/web_contents/web_drag_dest_gtk.h b/content/browser/web_contents/web_drag_dest_gtk.h
index 5082f31..6eaa104 100644
--- a/content/browser/web_contents/web_drag_dest_gtk.h
+++ b/content/browser/web_contents/web_drag_dest_gtk.h
@@ -29,8 +29,6 @@ class CONTENT_EXPORT WebDragDestGtk {
WebDragDestGtk(WebContents* web_contents, GtkWidget* widget);
~WebDragDestGtk();
- WebDropData* current_drop_data() const { return drop_data_.get(); }
-
// This is called when the renderer responds to a drag motion event. We must
// update the system drag cursor.
void UpdateDragStatus(WebKit::WebDragOperation operation);
diff --git a/content/public/browser/web_contents_view.h b/content/public/browser/web_contents_view.h
index 2d2394f..73abdc5 100644
--- a/content/public/browser/web_contents_view.h
+++ b/content/public/browser/web_contents_view.h
@@ -15,8 +15,6 @@
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
-struct WebDropData;
-
namespace content {
class RenderViewHost;
@@ -109,9 +107,6 @@ class CONTENT_EXPORT WebContentsView
virtual bool IsDoingDrag() const = 0;
virtual void CancelDragAndCloseTab() = 0;
- // Returns the current drop data, if any.
- virtual WebDropData* GetDropData() const = 0;
-
// If we close the tab while a UI control is in an event-tracking
// loop, the control may message freed objects and crash.
// WebContents::Close() calls IsEventTracking(), and if it returns
diff --git a/content/test/test_web_contents_view.cc b/content/test/test_web_contents_view.cc
index 40b9a35..52b5e32 100644
--- a/content/test/test_web_contents_view.cc
+++ b/content/test/test_web_contents_view.cc
@@ -120,10 +120,6 @@ bool TestWebContentsView::IsDoingDrag() const {
void TestWebContentsView::CancelDragAndCloseTab() {
}
-WebDropData* TestWebContentsView::GetDropData() const {
- return NULL;
-}
-
bool TestWebContentsView::IsEventTracking() const {
return false;
}
diff --git a/content/test/test_web_contents_view.h b/content/test/test_web_contents_view.h
index b37b81b..facf4d2 100644
--- a/content/test/test_web_contents_view.h
+++ b/content/test/test_web_contents_view.h
@@ -64,7 +64,6 @@ class TestWebContentsView : public WebContentsView {
virtual void RestoreFocus() OVERRIDE;
virtual bool IsDoingDrag() const OVERRIDE;
virtual void CancelDragAndCloseTab() OVERRIDE;
- virtual WebDropData* GetDropData() const OVERRIDE;
virtual bool IsEventTracking() const OVERRIDE;
virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual void GetViewBounds(gfx::Rect* out) const OVERRIDE;