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

Unified Diff: chrome/browser/resources/ntp4/drag_wrapper.js

Issue 8423055: [Aura] Initial app list webui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove grabber.js Created 9 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 | « chrome/browser/resources/ntp4/dot_list.js ('k') | chrome/browser/resources/ntp4/grabber.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/drag_wrapper.js
diff --git a/chrome/browser/resources/ntp4/drag_wrapper.js b/chrome/browser/resources/ntp4/drag_wrapper.js
deleted file mode 100644
index 9601b1c8af0406888bc5fe8491eb4c53cd8e6e31..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/ntp4/drag_wrapper.js
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (c) 2011 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.
-
-/**
- * @fileoverview DragWrapper
- * A class for simplifying HTML5 drag and drop. Classes should use this to
- * handle the nitty gritty of nested drag enters and leaves.
- */
-var DragWrapper = (function() {
- /**
- * Creates a DragWrapper which listens for drag target events on |target| and
- * delegates event handling to |handler|. The |handler| must implement:
- * shouldAcceptDrag
- * doDragEnter
- * doDragLeave
- * doDragOver
- * doDrop
- */
- function DragWrapper(target, handler) {
- this.initialize(target, handler);
- }
-
- DragWrapper.prototype = {
- initialize: function(target, handler) {
- target.addEventListener('dragenter',
- this.onDragEnter_.bind(this));
- target.addEventListener('dragover', this.onDragOver_.bind(this));
- target.addEventListener('drop', this.onDrop_.bind(this));
- target.addEventListener('dragleave', this.onDragLeave_.bind(this));
-
- this.target_ = target;
- this.handler_ = handler;
- },
-
- /**
- * The number of un-paired dragenter events that have fired on |this|. This
- * is incremented by |onDragEnter_| and decremented by |onDragLeave_|. This
- * is necessary because dragging over child widgets will fire additional
- * enter and leave events on |this|. A non-zero value does not necessarily
- * indicate that |isCurrentDragTarget()| is true.
- * @type {number}
- * @private
- */
- dragEnters_: 0,
-
- /**
- * Whether the tile page is currently being dragged over with data it can
- * accept.
- * @type {boolean}
- */
- get isCurrentDragTarget() {
- return this.target_.classList.contains('drag-target');
- },
-
- /**
- * Handler for dragenter events fired on |target_|.
- * @param {Event} e A MouseEvent for the drag.
- * @private
- */
- onDragEnter_: function(e) {
- if (++this.dragEnters_ == 1) {
- if (this.handler_.shouldAcceptDrag(e)) {
- this.target_.classList.add('drag-target');
- this.handler_.doDragEnter(e);
- }
- } else {
- // Sometimes we'll get an enter event over a child element without an
- // over event following it. In this case we have to still call the
- // drag over handler so that we make the necessary updates (one visible
- // symptom of not doing this is that the cursor's drag state will
- // flicker during drags).
- this.onDragOver_(e);
- }
- },
-
- /**
- * Thunk for dragover events fired on |target_|.
- * @param {Event} e A MouseEvent for the drag.
- * @private
- */
- onDragOver_: function(e) {
- if (!this.target_.classList.contains('drag-target'))
- return;
- this.handler_.doDragOver(e);
- },
-
- /**
- * Thunk for drop events fired on |target_|.
- * @param {Event} e A MouseEvent for the drag.
- * @private
- */
- onDrop_: function(e) {
- this.dragEnters_ = 0;
- if (!this.target_.classList.contains('drag-target'))
- return;
- this.target_.classList.remove('drag-target');
- this.handler_.doDrop(e);
- },
-
- /**
- * Thunk for dragleave events fired on |target_|.
- * @param {Event} e A MouseEvent for the drag.
- * @private
- */
- onDragLeave_: function(e) {
- if (--this.dragEnters_ > 0)
- return;
-
- this.target_.classList.remove('drag-target');
- this.handler_.doDragLeave(e);
- },
- };
-
- return DragWrapper;
-})();
« no previous file with comments | « chrome/browser/resources/ntp4/dot_list.js ('k') | chrome/browser/resources/ntp4/grabber.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698