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? |