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

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: Filters out URL clicks based on host matching only. 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
« no previous file with comments | « chrome/browser/chromeos/arc/arc_navigation_throttle.h ('k') | 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 3e3a3abe8a00cdb53d13b0997a9b216add21a3dc..2fd1e00c838cffb3b4b5c7c84a34aa6e23ff06ea 100644
--- a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
@@ -13,6 +13,7 @@
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
namespace arc {
@@ -65,6 +66,9 @@ ArcNavigationThrottle::WillStartRequest() {
if (!navigation_handle()->HasUserGesture())
return content::NavigationThrottle::PROCEED;
+ if (!ShouldOverrideUrlLoading(navigation_handle()))
+ return content::NavigationThrottle::PROCEED;
+
const GURL& url = navigation_handle()->GetURL();
mojom::IntentHelperInstance* bridge_instance = GetIntentHelper();
if (!bridge_instance)
@@ -207,4 +211,15 @@ void ArcNavigationThrottle::OnDisambigDialogClosed(
static_cast<int>(CloseReason::SIZE));
}
+bool ArcNavigationThrottle::ShouldOverrideUrlLoading(
+ content::NavigationHandle* navigation_handle) {
+ GURL previous_url = navigation_handle->GetReferrer().url;
+ GURL current_url = navigation_handle->GetURL();
+ if (net::registry_controlled_domains::SameDomainOrHost(
+ current_url, previous_url,
+ net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES))
+ return false;
+ return true;
+}
+
} // namespace arc
« no previous file with comments | « chrome/browser/chromeos/arc/arc_navigation_throttle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698