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

Unified Diff: chrome/browser/resources/bookmark_manager/js/dnd.js

Issue 543863002: Typecheck chrome://bookmarks using Closure Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: newest patchset Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/bookmark_manager/js/dnd.js
diff --git a/chrome/browser/resources/bookmark_manager/js/dnd.js b/chrome/browser/resources/bookmark_manager/js/dnd.js
index 7b2ee40a05d62af0bb14bd9ed86acc9d842dce18..5d5e8956b6588704d0d9697a3c8878a8be7edc07 100644
--- a/chrome/browser/resources/bookmark_manager/js/dnd.js
+++ b/chrome/browser/resources/bookmark_manager/js/dnd.js
@@ -47,7 +47,7 @@ cr.define('dnd', function() {
/**
* The style that was applied to indicate the drop location.
- * @type {string}
+ * @type {?string}
*/
var lastIndicatorClassName;
@@ -194,7 +194,7 @@ cr.define('dnd', function() {
/**
* External function to select folders or bookmarks after a drop action.
- * @type {function}
+ * @type {?Function}
*/
var selectItemsAfterUserAction = null;
@@ -208,7 +208,7 @@ cr.define('dnd', function() {
// If we are over the list and the list is showing search result, we cannot
// drop.
function isOverSearch(overElement) {
- return list.isSearch() && list.contains(overElement);
+ return $('list').isSearch() && $('list').contains(overElement);
Dan Beam 2014/09/25 04:27:18 can you use bmm.list instead?
Vitaly Pavlenko 2014/09/25 15:37:15 Done.
}
/**
@@ -219,7 +219,7 @@ cr.define('dnd', function() {
*/
function calculateValidDropTargets(overElement) {
// Don't allow dropping if there is an ephemeral item being edited.
- if (list.hasEphemeral())
+ if ($('list').hasEphemeral())
return DropPosition.NONE;
if (!dragInfo.isDragValid() || isOverSearch(overElement))
@@ -302,7 +302,7 @@ cr.define('dnd', function() {
// We are trying to drop an item past the last item. This is
// only allowed if dragged item is different from the last item
// in the list.
- var listItems = list.items;
+ var listItems = $('list').items;
var len = listItems.length;
if (!len || !dragInfo.isDraggingBookmark(listItems[len - 1].bookmarkId))
return true;
@@ -333,7 +333,7 @@ cr.define('dnd', function() {
// Do not allow dragging if there is an ephemeral item being edited at the
// moment.
- if (list.hasEphemeral())
+ if ($('list').hasEphemeral())
return;
if (draggedNodes.length) {
@@ -371,7 +371,7 @@ cr.define('dnd', function() {
return;
var overElement = getBookmarkElement(e.target) ||
- (e.target == list ? list : null);
+ (e.target == $('list') ? $('list') : null);
if (!overElement)
return;
@@ -450,16 +450,16 @@ cr.define('dnd', function() {
if (overElement instanceof ListItem) {
dropInfoResult.relatedIndex =
overElement.parentNode.dataModel.indexOf(relatedNode);
- dropInfoResult.selectTarget = list;
+ dropInfoResult.selectTarget = $('list');
} else if (overElement instanceof BookmarkList) {
dropInfoResult.relatedIndex = overElement.dataModel.length - 1;
- dropInfoResult.selectTarget = list;
+ dropInfoResult.selectTarget = $('list');
} else {
// Tree
dropInfoResult.relatedIndex = relatedNode.index;
- dropInfoResult.selectTarget = tree;
+ dropInfoResult.selectTarget = $('tree');
dropInfoResult.selectedTreeId =
- tree.selectedItem ? tree.selectedItem.bookmarkId : null;
+ $('tree').selectedItem ? $('tree').selectedItem.bookmarkId : null;
}
if (dropPos == DropPosition.ABOVE)
@@ -508,7 +508,7 @@ cr.define('dnd', function() {
function init(selectItemsAfterUserActionFunction) {
function deferredClearData() {
- setTimeout(clearDragData);
+ setTimeout(clearDragData, 0);
}
selectItemsAfterUserAction = selectItemsAfterUserActionFunction;

Powered by Google App Engine
This is Rietveld 408576698