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

Unified Diff: chrome/browser/resources/md_history/app.js

Issue 2152753003: MD History: Fix forward slash key not working in search field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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..07effee8f46ac89c546bf921db57ab489299a6ab 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':
+ if (this.$.toolbar.showingSearchField())
Dan Beam 2016/07/15 03:07:40 don't you actually want whether the search field i
tsergeant 2016/07/15 04:06:21 Yeah, there can be cases where the field is showin
lshang 2016/07/15 05:02:09 Yep, good point! I changed to regard forward slash
+ e.canExecute = false;
+ else
+ e.canExecute = true;
Dan Beam 2016/07/15 03:07:40 e.canExecute = !this.$.toolbar.showingSearchField(
lshang 2016/07/15 05:02:09 Done.
+ 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();
},
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/history.html » ('j') | chrome/browser/resources/md_history/history.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698