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

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2875153003: Added web::GetCommittedItemWithUniqueID function. (Closed)
Patch Set: Added GetCommittedItemIndexWithUniqueID Created 3 years, 7 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 | « ios/web/net/crw_ssl_status_updater.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index c51d5bf313e9dfbcb30dd75a5f69d7bfe8893670..ec226cd249b5f432585fc920048c2a1b8fdfed8c 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -44,6 +44,7 @@
#import "ios/web/navigation/crw_session_controller.h"
#import "ios/web/navigation/navigation_item_impl.h"
#import "ios/web/navigation/navigation_manager_impl.h"
+#include "ios/web/navigation/navigation_manager_util.h"
#include "ios/web/net/cert_host_pair.h"
#import "ios/web/net/crw_cert_verification_controller.h"
#import "ios/web/net/crw_ssl_status_updater.h"
@@ -4622,15 +4623,12 @@ registerLoadRequestForURL:(const GURL&)requestURL
// corresponds to committed navigation.
web::NavigationContextImpl* context =
[_navigationStates contextForNavigation:navigation];
- for (int i = 0; i < self.navigationManagerImpl->GetItemCount(); i++) {
- if (self.navigationManagerImpl->GetItemAtIndex(i)->GetUniqueID() ==
- context->GetNavigationItemUniqueID()) {
- // Do not discard pending entry, because another pending navigation is
- // still in progress and will commit or fail soon.
- [self.sessionController goToItemAtIndex:i discardNonCommittedItems:NO];
- break;
- }
- }
+ int itemIndex = web::GetCommittedItemIndexWithUniqueID(
+ self.navigationManagerImpl, context->GetNavigationItemUniqueID());
+ // Do not discard pending entry, because another pending navigation is still
+ // in progress and will commit or fail soon.
+ [self.sessionController goToItemAtIndex:itemIndex
+ discardNonCommittedItems:NO];
}
self.webStateImpl->OnNavigationFinished(context);
« no previous file with comments | « ios/web/net/crw_ssl_status_updater.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698