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

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

Issue 2237703004: [MD History] Focus the search bar on load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 4 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.crisper.js
diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js
index 3e75862e14094e32974a703a7d4959977c019372..f72faba842c089da77519327e3b79ac2ed8eb77c 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -14434,7 +14434,8 @@ Polymer({
},
unselectAllItems: function(count) {
- this.getSelectedList_().unselectAllItems(count);
+ if (this.getSelectedList_())
+ this.getSelectedList_().unselectAllItems(count);
},
/**
@@ -15126,6 +15127,22 @@ Polymer({
}
},
+ onFirstRender: function() {
+ // requestAnimationFrame allows measurement immediately before the next
+ // repaint, but after the first page of <iron-list> items has stamped.
+ requestAnimationFrame(function() {
+ chrome.send(
+ 'metricsHandler:recordTime',
+ ['History.ResultsRenderedTime', window.performance.now()]);
+ });
+
+ // Focus the search field on load. Done here to ensure the history page
+ // is rendered before we try to take focus.
+ if (!this.hasDrawer_) {
+ this.focusToolbarSearchField();
+ }
+ },
+
/** @private */
onMenuTap_: function() {
var drawer = this.$$('#drawer');
@@ -15176,6 +15193,13 @@ Polymer({
},
/**
+ * Focuses the search bar in the toolbar.
+ */
+ focusToolbarSearchField: function() {
+ this.$.toolbar.showSearchField();
+ },
+
+ /**
* Fired when the user presses 'More from this site'.
* @param {{detail: {domain: string}}} e
*/
@@ -15223,7 +15247,7 @@ Polymer({
*/
onCommand_: function(e) {
if (e.command.id == 'find-command' || e.command.id == 'slash-command')
- this.$.toolbar.showSearchField();
+ this.focusToolbarSearchField();
if (e.command.id == 'delete-command')
this.deleteSelected();
},

Powered by Google App Engine
This is Rietveld 408576698