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

Unified Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2912893002: MD Bookmarks: Support policies for disabling bookmark editing (Closed)
Patch Set: canEdit -> globalCanEdit Created 3 years, 6 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/md_bookmarks/dnd_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/dnd_manager.js b/chrome/browser/resources/md_bookmarks/dnd_manager.js
index a4423b3d66b89aa10cdd4e9f55c7bd8711cac4a3..71b1bcde1da76d1ec6d9c480ed6bf02d73021274 100644
--- a/chrome/browser/resources/md_bookmarks/dnd_manager.js
+++ b/chrome/browser/resources/md_bookmarks/dnd_manager.js
@@ -426,6 +426,13 @@ cr.define('bookmarks', function() {
e.preventDefault();
+ // If any node can't be dragged, early return (after preventDefault).
+ var anyUnmodifiable = draggedNodes.some(function(itemId) {
+ return !bookmarks.util.canEditNode(state, itemId);
+ });
+ if (anyUnmodifiable)
+ return;
+
// If we are dragging a single link, we can do the *Link* effect.
// Otherwise, we only allow copy and move.
if (e.dataTransfer) {
@@ -475,7 +482,6 @@ cr.define('bookmarks', function() {
if (!overElement)
return;
-
// Now we know that we can drop. Determine if we will drop above, on or
// below based on mouse position etc.
this.dropDestination_ =
@@ -547,6 +553,9 @@ cr.define('bookmarks', function() {
if (isBookmarkList(overElement))
itemId = state.selectedFolder;
+ if (!bookmarks.util.canReorderChildren(state, itemId))
+ return DropPosition.NONE;
+
// Drags of a bookmark onto itself or of a folder into its children aren't
// allowed.
if (dragInfo.isDraggingBookmark(itemId) ||
« no previous file with comments | « chrome/browser/resources/md_bookmarks/command_manager.js ('k') | chrome/browser/resources/md_bookmarks/folder_node.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698