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

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

Issue 2902103002: MD Bookmarks: Disable 'Open in Incognito Window' when Incognito is disabled (Closed)
Patch Set: Add a test Created 3 years, 7 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/command_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/command_manager.js b/chrome/browser/resources/md_bookmarks/command_manager.js
index 7dbf8d0761bdc5483eb2c99414124e2efad14d2a..f7d29ca20de2c05dde9e93ca290bd5cd16f7a1f8 100644
--- a/chrome/browser/resources/md_bookmarks/command_manager.js
+++ b/chrome/browser/resources/md_bookmarks/command_manager.js
@@ -89,6 +89,7 @@ cr.define('bookmarks', function() {
},
closeCommandMenu: function() {
+ this.menuIds_ = new Set();
calamity 2017/05/29 06:52:27 Does this functionally change anything, or is it j
tsergeant 2017/05/30 00:18:21 Menu item bindings are based entirely on the menuI
calamity 2017/06/01 04:07:44 I see. So menu items that have enable conditions t
tsergeant 2017/06/01 05:27:16 Yup, exactly.
/** @type {!CrActionMenuElement} */ (this.$.dropdown).close();
},
@@ -148,8 +149,10 @@ cr.define('bookmarks', function() {
switch (command) {
case Command.OPEN_NEW_TAB:
case Command.OPEN_NEW_WINDOW:
- case Command.OPEN_INCOGNITO:
return this.expandUrls_(itemIds).length > 0;
+ case Command.OPEN_INCOGNITO:
+ return this.expandUrls_(itemIds).length > 0 &&
+ this.getState().prefs.incognito != IncognitoAvailability.DISABLED;
default:
return true;
}
@@ -314,8 +317,8 @@ cr.define('bookmarks', function() {
* @private
*/
onCommandClick_: function(e) {
- this.closeCommandMenu();
this.handle(e.target.getAttribute('command'), assert(this.menuIds_));
+ this.closeCommandMenu();
},
/**
@@ -351,7 +354,7 @@ cr.define('bookmarks', function() {
if (e.path[0] != this.$.dropdown)
return;
- this.$.dropdown.close();
+ this.closeCommandMenu();
},
/**
@@ -367,7 +370,7 @@ cr.define('bookmarks', function() {
var label;
switch (command) {
case Command.EDIT:
- if (this.menuIds_.size > 1)
+ if (this.menuIds_.size != 1)
return '';
var id = Array.from(this.menuIds_)[0];

Powered by Google App Engine
This is Rietveld 408576698