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']); |
} |
}; |