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

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

Issue 1350073002: PDFs viewed inside a <webview> should navigate the same as PDFs in tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 c8753e14a6207dca698cd16144c70cb57dba82f9..86f00660064b37e2f559c85474f89594bb6b40d0 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -44,12 +44,12 @@ function getFilenameFromURL(url) {
* @param {string} url The url to be opened in the current tab.
*/
function onNavigateInCurrentTab(url) {
- // Prefer the tabs API because it can navigate from one file:// URL to
- // another.
- if (chrome.tabs)
Sam McNally 2015/09/18 01:03:47 Could we change this to if (chrome.tabs && this.
wjmaclean 2015/09/18 16:20:45 Yes, but in this context |this| is a "Navigator" a
- chrome.tabs.update({url: url});
- else
- window.location.href = url;
+ // chrome.tabs.update should not be used here, since it blocks the ability
+ // of an app embedding a PDF viewer inside a webview to perform in-place
+ // navigations (e.g. to the current tab). In these cases chrome.tabs.update
+ // just refers the navigation to the current browser, causing the navigation
+ // to occur in a new tab in the browser window, which is unexpected.
+ window.location.href = url;
}
/**
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | extensions/browser/guest_view/web_view/web_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698