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

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

Issue 2118383003: MD History: add shortcuts for search (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 887fa1cd76ce001e5fe653e783f3b211eaeff057..175f912be03a3087fa3a4d04145a6da99dfa7397 100644
--- a/chrome/browser/resources/md_history/app.js
+++ b/chrome/browser/resources/md_history/app.js
@@ -47,6 +47,10 @@ Polymer({
/** @override */
ready: function() {
this.grouped_ = loadTimeData.getBoolean('groupByDomain');
+
+ cr.ui.decorate('command', cr.ui.Command);
+ document.addEventListener('canExecute', this.onCanExecute_.bind(this));
+ document.addEventListener('command', this.onCommand_.bind(this));
},
/** @private */
@@ -108,6 +112,29 @@ Polymer({
searchDomain_: function(e) { this.$.toolbar.setSearchTerm(e.detail.domain); },
/**
+ * @param {Event} e
tsergeant 2016/07/05 07:47:22 Does the closure compile work successfully if you
lshang 2016/07/06 05:03:08 Seems closure compiler can't recognize cr.ui.CanEx
+ * @private
+ */
+ onCanExecute_: function(e) {
+ e = /** @type {cr.ui.CanExecuteEvent} */(e);
+ switch (e.command.id) {
tsergeant 2016/07/05 07:47:22 I think there's no need to have the switch here, y
lshang 2016/07/06 05:03:08 Done.
+ case 'find-command':
+ e.canExecute = true;
+ break;
+ }
+ },
+
+ /**
+ * @param {Event} e
+ * @private
+ */
+ onCommand_: function(e) {
+ e = /** @type {cr.ui.CanExecuteEvent} */(e);
+ if (e.command.id == 'find-command')
+ this.$.toolbar.onFindCommand();
+ },
+
+ /**
* @param {!Array<!ForeignSession>} sessionList Array of objects describing
* the sessions from other devices.
* @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile?

Powered by Google App Engine
This is Rietveld 408576698