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

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: Addressing nit. 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/navigator.js
diff --git a/chrome/browser/resources/pdf/navigator.js b/chrome/browser/resources/pdf/navigator.js
index b07c98cdb33ce0332840154a06b353fd99e2e61f..97343892152d8eb22b1dc6f2b8c44ad0026457a3 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 {Object} navigateInCurrentTabCallback The Callback function that get
raymes 2015/01/29 04:27:13 nit: get->gets nit: {Object}->{Function}
Deepak 2015/01/29 06:05:41 Done.
+ * called when navigation happen in the current tab.
raymes 2015/01/29 04:27:13 nit: happen->happens
Deepak 2015/01/29 06:05:41 Done.
+ * @param {Object} navigateInNewTabCallback The Callback function that get
raymes 2015/01/29 04:27:13 nit: get->gets nit: {Object}->{Function}
Deepak 2015/01/29 06:05:41 Done.
+ * called when navigation happen in the new tab.
raymes 2015/01/29 04:27:13 nit: happen->happens
Deepak 2015/01/29 06:05:41 Done.
*/
-function Navigator(originalUrl, viewport, paramsParser) {
+function Navigator(originalUrl,
+ viewport,
raymes 2015/01/29 04:27:13 nit: indentation - please align with the (
Deepak 2015/01/29 06:05:41 Done.
+ paramsParser,
+ navigateInCurrentTabCallback,
+ navigateInNewTabCallback) {
this.originalUrl_ = originalUrl;
this.viewport_ = viewport;
this.paramsParser_ = paramsParser;
+ this.navigateInCurrentTabCallback_ = navigateInCurrentTabCallback;
+ this.navigateInNewTabCallback_ = navigateInNewTabCallback;
}
Navigator.prototype = {
@@ -64,6 +74,7 @@ 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.
raymes 2015/01/30 03:45:03 Please keep this comment in the function that we p
+ this.navigateInNewTabCallback_();
if (chrome.tabs)
chrome.tabs.create({ url: url });
else
@@ -71,10 +82,12 @@ Navigator.prototype = {
} else {
var pageNumber =
this.paramsParser_.getViewportFromUrlParams(url).page;
- if (pageNumber != undefined)
+ if (pageNumber != undefined) {
this.viewport_.goToPage(pageNumber);
- else
+ } else {
+ this.navigateInCurrentTabCallback_();
window.location.href = url;
raymes 2015/01/29 04:27:13 The same with this line - it should be passed in a
Deepak 2015/01/29 06:05:41 Done.
+ }
}
}
};
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | chrome/browser/resources/pdf/pdf_extension_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698