Index: chrome/browser/resources/md_history/app.js |
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js |
index 6d3f5d4e2d111d016111463a05fa1550b1bec366..a451b9ff679cd694c08a30868d3707007f7df203 100644 |
--- a/chrome/browser/resources/md_history/app.js |
+++ b/chrome/browser/resources/md_history/app.js |
@@ -118,7 +118,18 @@ Polymer({ |
* @private |
*/ |
onCanExecute_: function(e) { |
- e.canExecute = true; |
+ e = /** @type {cr.ui.CanExecuteEvent} */(e); |
+ switch (e.command.id) { |
+ case 'find-command': |
+ e.canExecute = true; |
+ break; |
+ case 'slash-command': |
+ var field = |
+ /** @type {CrSearchFieldElement} */ this.$.toolbar.$['main-toolbar'] |
Dan Beam
2016/07/15 05:28:51
this type should technically be just "SearchField"
lshang
2016/07/19 01:23:00
Or it should be "CrToolbarSearchFieldElement"? tho
|
+ .getSearchField(); |
Dan Beam
2016/07/15 05:28:51
you should expose this through both HistoryToolbar
lshang
2016/07/19 01:23:00
Done.
|
+ e.canExecute = !(field.showingSearch && field.focused); |
+ break; |
+ } |
}, |
/** |
@@ -126,7 +137,7 @@ Polymer({ |
* @private |
*/ |
onCommand_: function(e) { |
- if (e.command.id == 'find-command') |
+ if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
this.$.toolbar.showSearchField(); |
}, |