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

Unified Diff: Source/devtools/front_end/SourcesPanel.js

Issue 57373002: DevTools: Add support for adding folders to workspace with drag and drop (renderer part) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/devtools/front_end/InspectorFrontendHostStub.js ('k') | Source/devtools/front_end/externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/SourcesPanel.js
diff --git a/Source/devtools/front_end/SourcesPanel.js b/Source/devtools/front_end/SourcesPanel.js
index c000a445a6fcb7d76d81d3b1d7120eaded279dec..17138ad241ec926eb9515022df8f01cdf1b2b1ad 100644
--- a/Source/devtools/front_end/SourcesPanel.js
+++ b/Source/devtools/front_end/SourcesPanel.js
@@ -1592,9 +1592,50 @@ WebInspector.SourcesView = function()
this.registerRequiredCSS("sourcesView.css");
this.element.id = "sources-panel-sources-view";
this.element.addStyleClass("vbox");
+ this.element.addEventListener("dragenter", this._onDragEnter.bind(this), true);
+ this.element.addEventListener("dragover", this._onDragOver.bind(this), true);
}
+WebInspector.SourcesView.dragAndDropFilesType = "Files";
+
WebInspector.SourcesView.prototype = {
+ _onDragEnter: function (event)
+ {
+ if (event.dataTransfer.types.indexOf(WebInspector.SourcesView.dragAndDropFilesType) === -1)
+ return;
+ event.consume(true);
+ },
+
+ _onDragOver: function (event)
+ {
+ if (event.dataTransfer.types.indexOf(WebInspector.SourcesView.dragAndDropFilesType) === -1)
+ return;
+ event.consume(true);
+ if (this._dragMaskElement)
+ return;
+ this._dragMaskElement = this.element.createChild("div", "fill drag-mask");
+ this._dragMaskElement.addEventListener("drop", this._onDrop.bind(this), true);
+ this._dragMaskElement.addEventListener("dragleave", this._onDragLeave.bind(this), true);
+ },
+
+ _onDrop: function (event)
+ {
+ event.consume(true);
+ var items = event.dataTransfer.items;
+ var item = /** @type {DataTransferItem} */ (items.length ? items[0] : null);
+ var entry = item.webkitGetAsEntry();
+ if (!entry.isDirectory)
+ return;
+ InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesystem);
pfeldman 2013/11/05 06:14:49 What's wrong with sendMessageToEmbedder(["upgradeD
kinuko 2013/11/05 07:46:16 toURL is not supported in DraggedFileSystem (due t
+ },
+
+ _onDragLeave: function (event)
+ {
+ event.consume(true);
+ this._dragMaskElement.remove();
+ delete this._dragMaskElement;
+ },
+
__proto__: WebInspector.View.prototype
}
« no previous file with comments | « Source/devtools/front_end/InspectorFrontendHostStub.js ('k') | Source/devtools/front_end/externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698