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..7539f69d1789631ed0ee4c01d3e9f5b2d7f96dd6 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. |
@@ -260,12 +273,14 @@ function PDFViewer(browserApi) { |
var isInTab = this.browserApi_.getStreamInfo().tabId != -1; |
var isSourceFileUrl = this.originalUrl_.indexOf('file://') == 0; |
- this.navigator_ = new Navigator(this.originalUrl_, |
- this.viewport_, this.paramsParser_, |
- onNavigateInCurrentTab.bind(undefined, |
- isInTab, |
- isSourceFileUrl), |
- onNavigateInNewTab); |
+ var onNavigateCallback = { |
+ currentTabCallback: onNavigateInCurrentTab.bind(undefined, isInTab, |
+ isSourceFileUrl), |
+ newTabCallback: onNavigateInNewTab, |
+ newWindowCallback: onNavigateInNewWindow |
+ }; |
+ this.navigator_ = new Navigator(this.originalUrl_, this.viewport_, |
+ this.paramsParser_, onNavigateCallback); |
raymes
2016/09/06 04:36:07
Then we could just pass in a new NavigatorDelegate
jaepark
2016/09/06 20:32:47
Done.
|
this.viewportScroller_ = |
new ViewportScroller(this.viewport_, this.plugin_, window); |