| Index: chrome/browser/resources/pdf/pdf.js
|
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
|
| index bb7118e9083e741bb0ccdc4b4671973b3844c911..322c5a7025cb1a88e05716b9351af100b792cbd2 100644
|
| --- a/chrome/browser/resources/pdf/pdf.js
|
| +++ b/chrome/browser/resources/pdf/pdf.js
|
| @@ -56,14 +56,15 @@ function onNavigateInCurrentTab(isInTab, isSourceFileUrl, url) {
|
| }
|
|
|
| /**
|
| - * Called when navigation happens in the new background tab.
|
| - * @param {string} url The url to be opened in the new background tab.
|
| + * Called when navigation happens in the new tab.
|
| + * @param {string} url The url to be opened in the new tab.
|
| + * @param {boolean} active Indicates if the new tab should be the active tab.
|
| */
|
| -function onNavigateInNewBackgroundTab(url) {
|
| +function onNavigateInNewTab(url, active) {
|
| // Prefer the tabs API because it guarantees we can just open a new tab.
|
| // window.open doesn't have this guarantee.
|
| if (chrome.tabs)
|
| - chrome.tabs.create({url: url, active: false});
|
| + chrome.tabs.create({url: url, active: active});
|
| else
|
| window.open(url);
|
| }
|
| @@ -238,7 +239,10 @@ function PDFViewer(browserApi) {
|
| }.bind(this));
|
|
|
| document.body.addEventListener('navigate', function(e) {
|
| - this.navigator_.navigate(e.detail.uri, e.detail.newtab);
|
| + var option =
|
| + e.detail.newtab ? Navigator.NavigateOption.OPEN_IN_NEW_BACKGROUND_TAB :
|
| + Navigator.NavigateOption.OPEN_IN_CURRENT_TAB;
|
| + this.navigator_.navigate(e.detail.uri, option);
|
| }.bind(this));
|
|
|
| this.toolbarManager_ =
|
| @@ -264,7 +268,7 @@ function PDFViewer(browserApi) {
|
| onNavigateInCurrentTab.bind(undefined,
|
| isInTab,
|
| isSourceFileUrl),
|
| - onNavigateInNewBackgroundTab);
|
| + onNavigateInNewTab);
|
| this.viewportScroller_ =
|
| new ViewportScroller(this.viewport_, this.plugin_, window);
|
|
|
| @@ -627,10 +631,13 @@ PDFViewer.prototype = {
|
| break;
|
| case 'navigate':
|
| // If in print preview, always open a new tab.
|
| - if (this.isPrintPreview_)
|
| - this.navigator_.navigate(message.data.url, true);
|
| - else
|
| - this.navigator_.navigate(message.data.url, message.data.newTab);
|
| + if (this.isPrintPreview_) {
|
| + this.navigator_.navigate(
|
| + message.data.url,
|
| + Navigator.NavigateOption.OPEN_IN_NEW_BACKGROUND_TAB);
|
| + } else {
|
| + this.navigator_.navigate(message.data.url, message.data.option);
|
| + }
|
| break;
|
| case 'setScrollPosition':
|
| var position = this.viewport_.position;
|
|
|