Chromium Code Reviews| 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..52b93207a509f261a4b0cb2a206338c495a5f8a9 100644 |
| --- a/chrome/browser/resources/pdf/navigator.js |
| +++ b/chrome/browser/resources/pdf/navigator.js |
| @@ -71,15 +71,27 @@ Navigator.prototype = { |
| return; |
| } |
| - if (newTab) { |
| + if (newTab) |
| this.navigateInNewTabCallback_(url); |
| - } else { |
| - var pageNumber = |
| - this.paramsParser_.getViewportFromUrlParams(url).page; |
| - if (pageNumber != undefined) |
| - this.viewport_.goToPage(pageNumber); |
| - else |
| - this.navigateInCurrentTabCallback_(url); |
| - } |
| + else |
| + this.onViewportReceived_(url); |
|
raymes
2015/02/16 22:44:04
This isn't what I meant. Please keep this the same
Deepak
2015/02/17 07:12:12
Done.
|
| + }, |
| + |
| + /** |
| + * @private |
| + * Function to decide weather to scroll the page to corresponding named |
| + * destination or open the url in the current tab. |
| + * param {string} url The new url for name destination or opening it in |
| + * current tab. |
| + */ |
| + onViewportReceived_: function(url) { |
| + this.paramsParser_.getViewportFromUrlParams( |
| + url, function(viewportPosition) { |
| + var pageNumber = viewportPosition.page; |
| + if (pageNumber != undefined) |
| + this.viewport_.goToPage(pageNumber); |
| + else |
| + this.navigateInCurrentTabCallback_(url); |
| + }.bind(this)); |
| } |
| }; |