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

Side by Side Diff: ui/webui/resources/js/cr/ui/drag_wrapper.js

Issue 2597013002: Run clang-format on ui/webui/resources (Closed)
Patch Set: remove cr_shared_menu.js Created 3 years, 12 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 unified diff | Download patch
OLDNEW
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 cr.define('cr.ui', function() { 10 cr.define('cr.ui', function() {
(...skipping 23 matching lines...) Expand all
34 doDrop: assertNotReached, 34 doDrop: assertNotReached,
35 }; 35 };
36 36
37 /** 37 /**
38 * Creates a DragWrapper which listens for drag target events on |target| and 38 * Creates a DragWrapper which listens for drag target events on |target| and
39 * delegates event handling to |delegate|. 39 * delegates event handling to |delegate|.
40 * @param {!Element} target 40 * @param {!Element} target
41 * @param {!cr.ui.DragWrapperDelegate} delegate 41 * @param {!cr.ui.DragWrapperDelegate} delegate
42 * @constructor 42 * @constructor
43 */ 43 */
44 function DragWrapper(target, delegate) { 44 function DragWrapper(target, delegate) { this.initialize(target, delegate); }
45 this.initialize(target, delegate);
46 }
47 45
48 DragWrapper.prototype = { 46 DragWrapper.prototype = {
49 initialize: function(target, delegate) { 47 initialize: function(target, delegate) {
50 target.addEventListener('dragenter', 48 target.addEventListener('dragenter', this.onDragEnter_.bind(this));
51 this.onDragEnter_.bind(this));
52 target.addEventListener('dragover', this.onDragOver_.bind(this)); 49 target.addEventListener('dragover', this.onDragOver_.bind(this));
53 target.addEventListener('drop', this.onDrop_.bind(this)); 50 target.addEventListener('drop', this.onDrop_.bind(this));
54 target.addEventListener('dragleave', this.onDragLeave_.bind(this)); 51 target.addEventListener('dragleave', this.onDragLeave_.bind(this));
55 52
56 this.target_ = target; 53 this.target_ = target;
57 this.delegate_ = delegate; 54 this.delegate_ = delegate;
58 }, 55 },
59 56
60 /** 57 /**
61 * The number of un-paired dragenter events that have fired on |this|. This 58 * The number of un-paired dragenter events that have fired on |this|. This
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 this.target_.classList.remove('drag-target'); 131 this.target_.classList.remove('drag-target');
135 this.delegate_.doDragLeave(e); 132 this.delegate_.doDragLeave(e);
136 }, 133 },
137 }; 134 };
138 135
139 return { 136 return {
140 DragWrapper: DragWrapper, 137 DragWrapper: DragWrapper,
141 DragWrapperDelegate: DragWrapperDelegate, 138 DragWrapperDelegate: DragWrapperDelegate,
142 }; 139 };
143 }); 140 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698