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

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

Issue 2962283002: MD Bookmarks: Add 'show in folder' command to search result context menu (Closed)
Patch Set: Rebase Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/constants.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/command_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/command_manager.js b/chrome/browser/resources/md_bookmarks/command_manager.js
index fefe8a6628c8c4562e768983afc2fad6ed5cb831..bbf67c71e4f1dc00b9d954df748849ce7c40d335 100644
--- a/chrome/browser/resources/md_bookmarks/command_manager.js
+++ b/chrome/browser/resources/md_bookmarks/command_manager.js
@@ -23,6 +23,7 @@ cr.define('bookmarks', function() {
return [
Command.EDIT,
Command.COPY_URL,
+ Command.SHOW_IN_FOLDER,
Command.DELETE,
// <hr>
Command.OPEN_NEW_TAB,
@@ -198,6 +199,15 @@ cr.define('bookmarks', function() {
return this.isSingleBookmark_(itemIds);
case Command.DELETE:
return itemIds.size > 0 && this.globalCanEdit_;
+ case Command.SHOW_IN_FOLDER:
+ // Hack: We only want this command to appear for list items (not
+ // sidebar folders) while a search is active. This works because right
+ // clicking a sidebar node will select that folder, clearing the
+ // search before the menu is displayed.
calamity 2017/07/10 05:51:38 Why not add a source to openCommandMenuAtPostion/E
tsergeant 2017/07/11 02:58:59 Done. I've added a MenuSource to the list for dete
+ return itemIds.size == 1 && this.getState().search.term != '' &&
+ !this.containsMatchingNode_(itemIds, function(node) {
+ return !node.parentId || node.parentId == ROOT_NODE_ID;
+ });
case Command.OPEN_NEW_TAB:
case Command.OPEN_NEW_WINDOW:
case Command.OPEN_INCOGNITO:
@@ -262,6 +272,11 @@ cr.define('bookmarks', function() {
labelPromise, state.nodes[idList[0]].title, false);
}.bind(this));
break;
+ case Command.SHOW_IN_FOLDER:
+ var id = Array.from(itemIds)[0];
+ this.dispatch(bookmarks.actions.selectFolder(
+ assert(state.nodes[id].parentId), state.nodes));
+ break;
case Command.DELETE:
var idList = Array.from(this.minimizeDeletionSet_(itemIds));
var title = state.nodes[idList[0]].title;
@@ -502,6 +517,9 @@ cr.define('bookmarks', function() {
case Command.DELETE:
label = 'menuDelete';
break;
+ case Command.SHOW_IN_FOLDER:
+ label = 'menuShowInFolder';
+ break;
case Command.OPEN_NEW_TAB:
label = multipleNodes ? 'menuOpenAllNewTab' : 'menuOpenNewTab';
break;
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698