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

Unified Diff: chrome/browser/resources/pdf/navigator.js

Issue 918953002: Fix for PDFs with lots of named destinations take a long time to load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 10 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 | « no previous file | chrome/browser/resources/pdf/open_pdf_params_parser.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/navigator.js
diff --git a/chrome/browser/resources/pdf/navigator.js b/chrome/browser/resources/pdf/navigator.js
index 57c15d4d26c47c983f83a839c766cb79d22f9dfe..bf86d5d371f6cbe74d8a68f51aec9abf4506ba31 100644
--- a/chrome/browser/resources/pdf/navigator.js
+++ b/chrome/browser/resources/pdf/navigator.js
@@ -74,12 +74,22 @@ Navigator.prototype = {
if (newTab) {
this.navigateInNewTabCallback_(url);
} else {
- var pageNumber =
- this.paramsParser_.getViewportFromUrlParams(url).page;
- if (pageNumber != undefined)
- this.viewport_.goToPage(pageNumber);
- else
- this.navigateInCurrentTabCallback_(url);
+ this.paramsParser_.getViewportFromUrlParams(
+ url, this.onViewportReceived_.bind(this));
}
+ },
+
+ /**
+ * @private
+ * Called when the viewport position is received.
+ * @param {Object} viewportPosition Dictionary containing the viewport
+ * position.
+ */
+ onViewportReceived_: function(viewportPosition) {
+ var pageNumber = viewportPosition.page;
+ if (pageNumber != undefined)
+ this.viewport_.goToPage(pageNumber);
+ else
+ this.navigateInCurrentTabCallback_(viewportPosition['url']);
}
};
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/open_pdf_params_parser.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698