OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {!Element} element | 7 * @param {!Element} element |
8 * @param {!Array.<string>} transferTypes | 8 * @param {!Array.<string>} transferTypes |
9 * @param {string} messageText | 9 * @param {string} messageText |
10 * @param {function(!DataTransfer)} handleDrop | 10 * @param {function(!DataTransfer)} handleDrop |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 _onDragOver: function(event) | 62 _onDragOver: function(event) |
63 { | 63 { |
64 if (!this._enabled || !this._hasMatchingType(event)) | 64 if (!this._enabled || !this._hasMatchingType(event)) |
65 return; | 65 return; |
66 event.dataTransfer.dropEffect = "copy"; | 66 event.dataTransfer.dropEffect = "copy"; |
67 event.consume(true); | 67 event.consume(true); |
68 if (this._dragMaskElement) | 68 if (this._dragMaskElement) |
69 return; | 69 return; |
70 this._dragMaskElement = this._element.createChild("div", ""); | 70 this._dragMaskElement = this._element.createChild("div", ""); |
71 var shadowRoot = this._dragMaskElement.createShadowRoot(); | 71 var shadowRoot = this._dragMaskElement.createShadowRoot(); |
72 shadowRoot.appendChild(WebInspector.View.createStyleElement("ui/dropTarg
et.css")); | 72 shadowRoot.appendChild(WebInspector.Widget.createStyleElement("ui/dropTa
rget.css")); |
73 shadowRoot.createChild("div", "drop-target-message").textContent = this.
_messageText; | 73 shadowRoot.createChild("div", "drop-target-message").textContent = this.
_messageText; |
74 this._dragMaskElement.addEventListener("drop", this._onDrop.bind(this),
true); | 74 this._dragMaskElement.addEventListener("drop", this._onDrop.bind(this),
true); |
75 this._dragMaskElement.addEventListener("dragleave", this._onDragLeave.bi
nd(this), true); | 75 this._dragMaskElement.addEventListener("dragleave", this._onDragLeave.bi
nd(this), true); |
76 }, | 76 }, |
77 | 77 |
78 /** | 78 /** |
79 * @param {!Event} event | 79 * @param {!Event} event |
80 */ | 80 */ |
81 _onDrop: function(event) | 81 _onDrop: function(event) |
82 { | 82 { |
(...skipping 11 matching lines...) Expand all Loading... |
94 event.consume(true); | 94 event.consume(true); |
95 this._removeMask(); | 95 this._removeMask(); |
96 }, | 96 }, |
97 | 97 |
98 _removeMask: function() | 98 _removeMask: function() |
99 { | 99 { |
100 this._dragMaskElement.remove(); | 100 this._dragMaskElement.remove(); |
101 delete this._dragMaskElement; | 101 delete this._dragMaskElement; |
102 } | 102 } |
103 } | 103 } |
OLD | NEW |