Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index c7b172078d7778472af64c4fe851a35bca15b73e..8cb012aac9e48dbcdb594a64267c344fb5848585 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -70,6 +70,19 @@ function onNavigateInNewTab(url, active) { |
} |
/** |
+ * Called when navigation happens in the new window. |
+ * @param {string} url The url to be opened in the new window. |
+ */ |
+function onNavigateInNewWindow(url) { |
+ // Prefer the windows API because it guarantees we can just open a new window. |
+ // window.open with '_blank' argument doesn't have this guarantee. |
+ if (chrome.windows) |
+ chrome.windows.create({url: url}); |
+ else |
+ window.open(url, '_blank'); |
+} |
+ |
+/** |
* Whether keydown events should currently be ignored. Events are ignored when |
* an editable element has focus, to allow for proper editing controls. |
* @param {HTMLElement} activeElement The currently selected DOM node. |
@@ -265,7 +278,7 @@ function PDFViewer(browserApi) { |
onNavigateInCurrentTab.bind(undefined, |
isInTab, |
isSourceFileUrl), |
- onNavigateInNewTab); |
+ onNavigateInNewTab, onNavigateInNewWindow); |
this.viewportScroller_ = |
new ViewportScroller(this.viewport_, this.plugin_, window); |