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

Unified Diff: components/dom_distiller/core/javascript/dom_distiller_viewer.js

Issue 1575473002: Improve syncing between dom distiller and the print preview request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added TODO item - resources readiness before calling doprintpreview Created 4 years, 8 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/ui/webui/print_preview/print_preview_distiller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/core/javascript/dom_distiller_viewer.js
diff --git a/components/dom_distiller/core/javascript/dom_distiller_viewer.js b/components/dom_distiller/core/javascript/dom_distiller_viewer.js
index 009f1f7b14e5398eb22a34a0d28c3099d13141c3..5baef4c077b01e799ed52389fda294a596d17fb9 100644
--- a/components/dom_distiller/core/javascript/dom_distiller_viewer.js
+++ b/components/dom_distiller/core/javascript/dom_distiller_viewer.js
@@ -10,14 +10,6 @@ function addToPage(html) {
div.innerHTML = html;
document.getElementById('content').appendChild(div);
fillYouTubePlaceholders();
-
- if (typeof navigate_on_initial_content_load !== 'undefined' &&
- navigate_on_initial_content_load) {
- navigate_on_initial_content_load = false;
- setTimeout(function() {
- window.location = window.location + "#loaded";
- }, 0);
- }
}
function fillYouTubePlaceholders() {
@@ -48,6 +40,14 @@ function fillYouTubePlaceholders() {
function showLoadingIndicator(isLastPage) {
document.getElementById('loadingIndicator').className =
isLastPage ? 'hidden' : 'visible';
+ // This function will be one of the last things to occur when a page is
+ // loaded. This is temporarily used to signal print preview to generate
+ // a PDF.
+ if (isLastPage) {
+ setTimeout(function() {
+ window.location = window.location + "#loaded";
+ }, 0);
+ }
}
// Sets the title.
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_distiller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698