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

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

Issue 2568903002: PDF viewer: Specify tabId when navigating with chrome.tabs.update. (Closed)
Patch Set: Fix nits. Created 4 years 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 | « chrome/browser/pdf/pdf_extension_test.cc ('k') | 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 ba6b7e0e84c84d388990f6c36b866f27ac118965..15c4518e1280ddaf907b0ba757c968e369dbaab9 100644
--- a/chrome/browser/resources/pdf/navigator.js
+++ b/chrome/browser/resources/pdf/navigator.js
@@ -7,10 +7,11 @@
/**
* Creates a new NavigatorDelegate for calling browser-specific functions to
* do the actual navigating.
- * @param {boolean} isInTab Indicates if the PDF viewer is displayed in a tab.
+ * @param {number} tabId The tab ID of the PDF viewer or -1 if the viewer is
+ * not displayed in a tab.
*/
-function NavigatorDelegate(isInTab) {
- this.isInTab_ = isInTab;
+function NavigatorDelegate(tabId) {
+ this.tabId_ = tabId;
}
/**
@@ -38,8 +39,8 @@ NavigatorDelegate.prototype = {
navigateInCurrentTab: function(url) {
// When the PDFviewer is inside a browser tab, prefer the tabs API because
// it can navigate from one file:// URL to another.
- if (chrome.tabs && this.isInTab_)
- chrome.tabs.update({url: url});
+ if (chrome.tabs && this.tabId_ != -1)
+ chrome.tabs.update(this.tabId_, {url: url});
else
window.location.href = url;
},
« no previous file with comments | « chrome/browser/pdf/pdf_extension_test.cc ('k') | chrome/browser/resources/pdf/pdf.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698