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

Unified Diff: chrome/browser/resources/pdf/navigator.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
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/navigator.js
diff --git a/chrome/browser/resources/pdf/navigator.js b/chrome/browser/resources/pdf/navigator.js
index b07c98cdb33ce0332840154a06b353fd99e2e61f..57c15d4d26c47c983f83a839c766cb79d22f9dfe 100644
--- a/chrome/browser/resources/pdf/navigator.js
+++ b/chrome/browser/resources/pdf/navigator.js
@@ -9,11 +9,21 @@
* @param {string} originalUrl The original page URL.
* @param {Object} viewport The viewport info of the page.
* @param {Object} paramsParser The object for URL parsing.
+ * @param {Function} navigateInCurrentTabCallback The Callback function that
+ * gets called when navigation happens in the current tab.
+ * @param {Function} navigateInNewTabCallback The Callback function that gets
+ * called when navigation happens in the new tab.
*/
-function Navigator(originalUrl, viewport, paramsParser) {
+function Navigator(originalUrl,
+ viewport,
+ paramsParser,
+ navigateInCurrentTabCallback,
+ navigateInNewTabCallback) {
this.originalUrl_ = originalUrl;
this.viewport_ = viewport;
this.paramsParser_ = paramsParser;
+ this.navigateInCurrentTabCallback_ = navigateInCurrentTabCallback;
+ this.navigateInNewTabCallback_ = navigateInNewTabCallback;
}
Navigator.prototype = {
@@ -62,19 +72,14 @@ Navigator.prototype = {
}
if (newTab) {
- // Prefer the tabs API because it guarantees we can just open a new tab.
- // window.open doesn't have this guarantee.
- if (chrome.tabs)
- chrome.tabs.create({ url: url });
- else
- window.open(url);
+ this.navigateInNewTabCallback_(url);
} else {
var pageNumber =
this.paramsParser_.getViewportFromUrlParams(url).page;
if (pageNumber != undefined)
this.viewport_.goToPage(pageNumber);
else
- window.location.href = url;
+ this.navigateInCurrentTabCallback_(url);
}
}
};
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698