Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 838723003: Testcases for nameddests and navigate for PDF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
*/

Powered by Google App Engine
This is Rietveld 408576698