Chromium Code Reviews| Index: chrome/browser/resources/pdf/pdf.js |
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
| index c8753e14a6207dca698cd16144c70cb57dba82f9..46eb45df5472179a550b77ea670bfc0dbc9a1f81 100644 |
| --- a/chrome/browser/resources/pdf/pdf.js |
| +++ b/chrome/browser/resources/pdf/pdf.js |
| @@ -41,13 +41,14 @@ function getFilenameFromURL(url) { |
| /** |
| * Called when navigation happens in the current tab. |
| + * @param {number} tabId The id of the current tab; -1 if no current tab. |
| * @param {string} url The url to be opened in the current tab. |
| */ |
| -function onNavigateInCurrentTab(url) { |
| - // Prefer the tabs API because it can navigate from one file:// URL to |
| - // another. |
| - if (chrome.tabs) |
| - chrome.tabs.update({url: url}); |
| +function onNavigateInCurrentTab(tabId, url) { |
| + // When the PDFviewer is not inside a <webview>, prefer the tabs API because |
| + // it can navigate from one file:// URL to another. |
| + if (chrome.tabs && tabId != -1) |
|
Dan Beam
2015/09/28 15:59:11
are you using tabId == -1 basically as a check to
wjmaclean
2015/09/28 16:10:09
We could change it to
@param {boolean} inTab
pe
raymes
2015/09/29 01:46:27
I agree - there might be other cases where we don'
|
| + chrome.tabs.update(tabId, {url: url}); |
| else |
| window.location.href = url; |
| } |
| @@ -252,7 +253,9 @@ function PDFViewer(browserApi) { |
| new OpenPDFParamsParser(this.getNamedDestination_.bind(this)); |
| this.navigator_ = new Navigator(this.browserApi_.getStreamInfo().originalUrl, |
| this.viewport_, this.paramsParser_, |
| - onNavigateInCurrentTab, onNavigateInNewTab); |
| + onNavigateInCurrentTab.bind(undefined, |
| + this.browserApi_.getStreamInfo().tabId), |
|
Dan Beam
2015/09/28 15:59:12
wait, don't you *want* this to use the current tab
wjmaclean
2015/09/28 16:10:08
Well, yes, I think we would. However, it's not at
raymes
2015/09/29 01:46:27
Correct - the tabId will never change.
|
| + onNavigateInNewTab); |
| this.viewportScroller_ = |
| new ViewportScroller(this.viewport_, this.plugin_, window); |
| } |