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

Side by Side Diff: chrome/browser/resources/md_history/history.js

Issue 2237703004: [MD History] Focus the search bar on load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Send the history query immediately. This allows the query to process during 5 // Send the history query immediately. This allows the query to process during
6 // the initial page startup. 6 // the initial page startup.
7 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); 7 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]);
8 chrome.send('getForeignSessions'); 8 chrome.send('getForeignSessions');
9 9
10 /** @type {Promise} */ 10 /** @type {Promise} */
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 if (!resultsRendered) { 45 if (!resultsRendered) {
46 resultsRendered = true; 46 resultsRendered = true;
47 // requestAnimationFrame allows measurement immediately before the next 47 // requestAnimationFrame allows measurement immediately before the next
48 // repaint, but after the first page of <iron-list> items has stamped. 48 // repaint, but after the first page of <iron-list> items has stamped.
49 requestAnimationFrame(function() { 49 requestAnimationFrame(function() {
50 chrome.send( 50 chrome.send(
51 'metricsHandler:recordTime', 51 'metricsHandler:recordTime',
52 ['History.ResultsRenderedTime', window.performance.now()]); 52 ['History.ResultsRenderedTime', window.performance.now()]);
53 }); 53 });
54
55 // Focus the search field on load. Done here to ensure the history page
56 // is rendered before we try to take focus.
57 $('history-app').focusToolbarSearchField();
54 } 58 }
55 }); 59 });
56 } 60 }
57 61
58 /** 62 /**
59 * Called by the history backend after receiving results and after discovering 63 * Called by the history backend after receiving results and after discovering
60 * the existence of other forms of browsing history. 64 * the existence of other forms of browsing history.
61 * @param {boolean} hasSyncedResults Whether there are synced results. 65 * @param {boolean} hasSyncedResults Whether there are synced results.
62 * @param {boolean} includeOtherFormsOfBrowsingHistory Whether to include 66 * @param {boolean} includeOtherFormsOfBrowsingHistory Whether to include
63 * a sentence about the existence of other forms of browsing history. 67 * a sentence about the existence of other forms of browsing history.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 /** 104 /**
101 * Called by the history backend after user's sign in state changes. 105 * Called by the history backend after user's sign in state changes.
102 * @param {boolean} isUserSignedIn Whether user is signed in or not now. 106 * @param {boolean} isUserSignedIn Whether user is signed in or not now.
103 */ 107 */
104 function updateSignInState(isUserSignedIn) { 108 function updateSignInState(isUserSignedIn) {
105 waitForAppUpgrade().then(function() { 109 waitForAppUpgrade().then(function() {
106 /** @type {HistoryAppElement} */($('history-app')) 110 /** @type {HistoryAppElement} */($('history-app'))
107 .updateSignInState(isUserSignedIn); 111 .updateSignInState(isUserSignedIn);
108 }); 112 });
109 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698