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

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

Issue 2113123002: Filters out URL clicks based on host matching only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/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 3e3a3abe8a00cdb53d13b0997a9b216add21a3dc..fd41e629103ec58beab07bb660c20a05c9983b38 100644
--- a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
@@ -65,6 +65,9 @@ ArcNavigationThrottle::WillStartRequest() {
if (!navigation_handle()->HasUserGesture())
return content::NavigationThrottle::PROCEED;
+ if (!ShouldOverrideUrlLoading())
+ return content::NavigationThrottle::PROCEED;
+
const GURL& url = navigation_handle()->GetURL();
mojom::IntentHelperInstance* bridge_instance = GetIntentHelper();
if (!bridge_instance)
@@ -207,4 +210,12 @@ void ArcNavigationThrottle::OnDisambigDialogClosed(
static_cast<int>(CloseReason::SIZE));
}
+bool ArcNavigationThrottle::ShouldOverrideUrlLoading() {
Yusuke Sato 2016/07/01 14:05:24 Is it possible to add unit tests for this?
malaykeshav 2016/07/01 23:20:41 Can be made unit testable. Just need to pass navig
+ std::string previous_url = navigation_handle()->GetReferrer().url.host();
+ std::string current_url = navigation_handle()->GetURL().host();
+ if (current_url == previous_url)
Yusuke Sato 2016/07/01 14:05:24 I think this function should also return false whe
malaykeshav 2016/07/01 23:20:41 If we are going from mail.google.com to maps.googl
Yusuke Sato 2016/07/01 23:35:56 The original Clank code seems to properly handle s
+ return false;
+ return true;
+}
+
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698