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

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

Issue 2235593002: Vulcanize MD History (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/md_history/history.html ('k') | chrome/browser/resources/md_history/vulcanize.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_history/history.js
diff --git a/chrome/browser/resources/md_history/history.js b/chrome/browser/resources/md_history/history.js
index 4cce580cc9e8ccc0e21f3930cb76b28bed560a43..07ea5d27158d57e08f073d6069492a0b6d3aa46b 100644
--- a/chrome/browser/resources/md_history/history.js
+++ b/chrome/browser/resources/md_history/history.js
@@ -13,16 +13,21 @@ var upgradePromise = null;
var resultsRendered = false;
/**
- * @return {!Promise} Resolves once the history-app has been fully upgraded.
+ * @return {!Promise<!HistoryAppElement>} Resolves once the history-app has been
+ * fully upgraded.
*/
-function waitForAppUpgrade() {
+function waitForHistoryApp() {
if (!upgradePromise) {
upgradePromise = new Promise(function(resolve, reject) {
if (window.Polymer && Polymer.isInstance &&
- Polymer.isInstance($('history-app'))) {
- resolve();
+ Polymer.isInstance(document.querySelector('history-app'))) {
+ resolve(/** @type {!HistoryAppElement} */(
+ document.querySelector('history-app')));
} else {
- $('bundle').addEventListener('load', resolve);
+ $('bundle').addEventListener('load', function() {
+ resolve(/** @type {!HistoryAppElement} */(
+ document.querySelector('history-app')));
+ });
}
});
}
@@ -37,9 +42,8 @@ function waitForAppUpgrade() {
* @param {!Array<HistoryEntry>} results A list of results.
*/
function historyResult(info, results) {
- waitForAppUpgrade().then(function() {
- /** @type {HistoryAppElement} */($('history-app'))
- .historyResult(info, results);
+ waitForHistoryApp().then(function(historyApp) {
+ historyApp.historyResult(info, results);
document.body.classList.remove('loading');
if (!resultsRendered) {
@@ -69,9 +73,8 @@ function showNotification(
// in the MD history anymore, so the parameter is not needed. Remove it
// when WebUI is removed and this becomes the only client of
// BrowsingHistoryHandler.
- waitForAppUpgrade().then(function() {
- /** @type {HistoryAppElement} */ ($('history-app')).showSidebarFooter =
- includeOtherFormsOfBrowsingHistory;
+ waitForHistoryApp().then(function(historyApp) {
+ historyApp.showSidebarFooter = includeOtherFormsOfBrowsingHistory;
});
}
@@ -85,9 +88,8 @@ function showNotification(
* @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile?
*/
function setForeignSessions(sessionList, isTabSyncEnabled) {
- waitForAppUpgrade().then(function() {
- /** @type {HistoryAppElement} */($('history-app'))
- .setForeignSessions(sessionList, isTabSyncEnabled);
+ waitForHistoryApp().then(function(historyApp) {
+ historyApp.setForeignSessions(sessionList, isTabSyncEnabled);
});
}
@@ -102,8 +104,7 @@ function historyDeleted() {
* @param {boolean} isUserSignedIn Whether user is signed in or not now.
*/
function updateSignInState(isUserSignedIn) {
- waitForAppUpgrade().then(function() {
- /** @type {HistoryAppElement} */($('history-app'))
- .updateSignInState(isUserSignedIn);
+ waitForHistoryApp().then(function(historyApp) {
+ historyApp.updateSignInState(isUserSignedIn);
});
}
« no previous file with comments | « chrome/browser/resources/md_history/history.html ('k') | chrome/browser/resources/md_history/vulcanize.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698