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

Unified Diff: ios/web/navigation/navigation_manager_impl.mm

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Adding a DCHECK to probably make a lot of tests fail. Created 3 years, 11 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: ios/web/navigation/navigation_manager_impl.mm
diff --git a/ios/web/navigation/navigation_manager_impl.mm b/ios/web/navigation/navigation_manager_impl.mm
index 6d7835c92d4c47ab694a11b77e8198b34d45afa2..9c409dc79c8ddaacadb3ed38d0f83706fbb6aa24 100644
--- a/ios/web/navigation/navigation_manager_impl.mm
+++ b/ios/web/navigation/navigation_manager_impl.mm
@@ -18,28 +18,13 @@
#include "ios/web/public/load_committed_details.h"
#import "ios/web/public/navigation_item.h"
#import "ios/web/public/web_state/web_state.h"
+#include "net/base/url_util.h"
#include "ui/base/page_transition_types.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
-namespace {
-
-// Checks whether or not two URL are an in-page navigation (differing only
-// in the fragment).
-bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
- if (existing_url == new_url || !new_url.has_ref())
- return false;
-
- url::Replacements<char> replacements;
- replacements.ClearRef();
- return existing_url.ReplaceComponents(replacements) ==
- new_url.ReplaceComponents(replacements);
-}
-
-} // anonymous namespace
-
namespace web {
NavigationManager::WebLoadParams::WebLoadParams(const GURL& url)
@@ -146,8 +131,8 @@ void NavigationManagerImpl::OnNavigationItemCommitted() {
DCHECK([session_controller_ previousEntry]);
details.previous_url =
[session_controller_ previousEntry].navigationItem->GetURL();
- details.is_in_page =
- AreURLsInPageNavigation(details.previous_url, details.item->GetURL());
+ details.is_in_page = net::IsFragmentAddedOrUpdated(details.previous_url,
+ details.item->GetURL());
} else {
details.previous_url = GURL();
details.is_in_page = NO;

Powered by Google App Engine
This is Rietveld 408576698