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

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

Issue 1275173004: PDF: Use chrome.tabs.update() to navigate, when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index 3fb61482a5e994149ec83f6ad9d9a90705b18a9a..61dd1600f01b3e8c82e191763bc4fe2d7dc240d8 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -35,7 +35,12 @@ function getFilenameFromURL(url) {
* @param {string} url The url to be opened in the current tab.
*/
function onNavigateInCurrentTab(url) {
- window.location.href = url;
+ // Prefer the tabs API because it can navigate from one file:// URL to
+ // another.
+ if (chrome.tabs)
+ chrome.tabs.update({url: url});
+ else
+ window.location.href = url;
}
/**
@@ -46,7 +51,7 @@ function onNavigateInNewTab(url) {
// 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});
+ chrome.tabs.create({url: url});
else
window.open(url);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698