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

Unified Diff: chrome/browser/chromeos/arc/arc_navigation_throttle.cc

Issue 2436923002: Capture http to https navigations w/ intent picker (Closed)
Patch Set: Adding up to the code comments. Created 4 years, 2 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/chromeos/arc/arc_navigation_throttle.cc
diff --git a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
index d2d290b20c8664f8081e47e08077b600f870dc2a..b5b9ac59c810e67943f595380515bea3eed7cdb0 100644
--- a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
@@ -119,8 +119,22 @@ ArcNavigationThrottle::HandleRequest() {
kAllowFormSubmit))
return content::NavigationThrottle::PROCEED;
- const GURL previous_url = navigation_handle()->GetReferrer().url;
+ const GURL referrer_url = navigation_handle()->GetReferrer().url;
const GURL current_url = navigation_handle()->GetURL();
+ const GURL last_committed_url =
+ navigation_handle()->GetWebContents()->GetLastCommittedURL();
+
+ // For navigations from http to https we clean up the Referrer as part of the
+ // sanitization proccess, however we may still have access to the last
+ // committed URL. On the other hand, navigations started within a new tab
+ // (e.g. due to target="_blank") will keep no track of any previous entries
+ // and so GetLastCommittedURL() can be seen empty sometimes, this is why we
+ // use one or the other accordingly. Also we don't use GetVisibleURL() since
+ // it may contain a still non-committed URL (i.e. it can be the same as
+ // GetURL()).
+ const GURL previous_url =
+ referrer_url.is_empty() ? last_committed_url : referrer_url;
+
if (!ShouldOverrideUrlLoading(previous_url, current_url))
return content::NavigationThrottle::PROCEED;
« 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