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 fb4d3ee53a3d7d19b7c918089fcc09b3de7097a1..11d35079867b966803ed3efccc999d74e728c9de 100644 |
| --- a/chrome/browser/resources/pdf/pdf.js |
| +++ b/chrome/browser/resources/pdf/pdf.js |
| @@ -156,7 +156,8 @@ function PDFViewer(streamDetails) { |
| // Parse open pdf parameters. |
| this.paramsParser_ = new OpenPDFParamsParser(); |
| this.navigator_ = new Navigator(this.streamDetails_.originalUrl, |
| - this.viewport_, this.paramsParser_); |
| + this.viewport_, this.paramsParser_, this.onNavigateInCurrentTab_, |
| + this.onNavigateInNewTab_); |
| } |
| PDFViewer.prototype = { |
| @@ -371,6 +372,27 @@ PDFViewer.prototype = { |
| /** |
| * @private |
| + * Called when navigation happens in the current tab. |
| + * @param {string} url The url to be opened in the current tab. |
| + */ |
| + onNavigateInCurrentTab_: function(url) { |
| + window.location.href = url; |
| + }, |
|
raymes
2015/02/01 23:50:38
These don't need to be functions hanging off of PD
Deepak
2015/02/02 04:00:12
Done.
|
| + |
| + /** |
| + * @private |
| + * Called when navigation happens in the new tab. |
| + * @param {string} url The url to be opened in the new tab. |
| + */ |
| + onNavigateInNewTab_: function(url) { |
| + if (chrome.tabs) |
|
raymes
2015/02/01 23:50:38
We used to have a comment here, it disapeared!
Deepak
2015/02/02 04:00:12
Done.
|
| + chrome.tabs.create({ url: url}); |
| + else |
| + window.open(url); |
| + }, |
| + |
| + /** |
| + * @private |
| * An event handler for handling message events received from the plugin. |
| * @param {MessageObject} message a message event. |
| */ |