| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * @fileoverview DragWrapper | 6 * @fileoverview DragWrapper |
| 7 * A class for simplifying HTML5 drag and drop. Classes should use this to | 7 * A class for simplifying HTML5 drag and drop. Classes should use this to |
| 8 * handle the nitty gritty of nested drag enters and leaves. | 8 * handle the nitty gritty of nested drag enters and leaves. |
| 9 */ | 9 */ |
| 10 var DragWrapper = (function() { | 10 cr.define('cr.ui', function() { |
| 11 /** | 11 /** |
| 12 * Creates a DragWrapper which listens for drag target events on |target| and | 12 * Creates a DragWrapper which listens for drag target events on |target| and |
| 13 * delegates event handling to |handler|. The |handler| must implement: | 13 * delegates event handling to |handler|. The |handler| must implement: |
| 14 * shouldAcceptDrag | 14 * shouldAcceptDrag |
| 15 * doDragEnter | 15 * doDragEnter |
| 16 * doDragLeave | 16 * doDragLeave |
| 17 * doDragOver | 17 * doDragOver |
| 18 * doDrop | 18 * doDrop |
| 19 */ | 19 */ |
| 20 function DragWrapper(target, handler) { | 20 function DragWrapper(target, handler) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 */ | 105 */ |
| 106 onDragLeave_: function(e) { | 106 onDragLeave_: function(e) { |
| 107 if (--this.dragEnters_ > 0) | 107 if (--this.dragEnters_ > 0) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 this.target_.classList.remove('drag-target'); | 110 this.target_.classList.remove('drag-target'); |
| 111 this.handler_.doDragLeave(e); | 111 this.handler_.doDragLeave(e); |
| 112 }, | 112 }, |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 return DragWrapper; | 115 return { |
| 116 })(); | 116 DragWrapper: DragWrapper |
| 117 }; |
| 118 }); |
| OLD | NEW |