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 b07c98cdb33ce0332840154a06b353fd99e2e61f..97343892152d8eb22b1dc6f2b8c44ad0026457a3 100644 |
| --- a/chrome/browser/resources/pdf/navigator.js |
| +++ b/chrome/browser/resources/pdf/navigator.js |
| @@ -9,11 +9,21 @@ |
| * @param {string} originalUrl The original page URL. |
| * @param {Object} viewport The viewport info of the page. |
| * @param {Object} paramsParser The object for URL parsing. |
| + * @param {Object} navigateInCurrentTabCallback The Callback function that get |
|
raymes
2015/01/29 04:27:13
nit: get->gets
nit: {Object}->{Function}
Deepak
2015/01/29 06:05:41
Done.
|
| + * called when navigation happen in the current tab. |
|
raymes
2015/01/29 04:27:13
nit: happen->happens
Deepak
2015/01/29 06:05:41
Done.
|
| + * @param {Object} navigateInNewTabCallback The Callback function that get |
|
raymes
2015/01/29 04:27:13
nit: get->gets
nit: {Object}->{Function}
Deepak
2015/01/29 06:05:41
Done.
|
| + * called when navigation happen in the new tab. |
|
raymes
2015/01/29 04:27:13
nit: happen->happens
Deepak
2015/01/29 06:05:41
Done.
|
| */ |
| -function Navigator(originalUrl, viewport, paramsParser) { |
| +function Navigator(originalUrl, |
| + viewport, |
|
raymes
2015/01/29 04:27:13
nit: indentation - please align with the (
Deepak
2015/01/29 06:05:41
Done.
|
| + paramsParser, |
| + navigateInCurrentTabCallback, |
| + navigateInNewTabCallback) { |
| this.originalUrl_ = originalUrl; |
| this.viewport_ = viewport; |
| this.paramsParser_ = paramsParser; |
| + this.navigateInCurrentTabCallback_ = navigateInCurrentTabCallback; |
| + this.navigateInNewTabCallback_ = navigateInNewTabCallback; |
| } |
| Navigator.prototype = { |
| @@ -64,6 +74,7 @@ Navigator.prototype = { |
| if (newTab) { |
| // Prefer the tabs API because it guarantees we can just open a new tab. |
| // window.open doesn't have this guarantee. |
|
raymes
2015/01/30 03:45:03
Please keep this comment in the function that we p
|
| + this.navigateInNewTabCallback_(); |
| if (chrome.tabs) |
| chrome.tabs.create({ url: url }); |
| else |
| @@ -71,10 +82,12 @@ Navigator.prototype = { |
| } else { |
| var pageNumber = |
| this.paramsParser_.getViewportFromUrlParams(url).page; |
| - if (pageNumber != undefined) |
| + if (pageNumber != undefined) { |
| this.viewport_.goToPage(pageNumber); |
| - else |
| + } else { |
| + this.navigateInCurrentTabCallback_(); |
| window.location.href = url; |
|
raymes
2015/01/29 04:27:13
The same with this line - it should be passed in a
Deepak
2015/01/29 06:05:41
Done.
|
| + } |
| } |
| } |
| }; |