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

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

Issue 2724073005: Remove NavigationManager::GetPreviousItem(). (Closed)
Patch Set: Address comments. Created 3 years, 10 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/navigation/crw_session_controller.h ('k') | ios/web/navigation/navigation_manager_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/navigation/crw_session_controller.mm
diff --git a/ios/web/navigation/crw_session_controller.mm b/ios/web/navigation/crw_session_controller.mm
index fca9891d71788412f168806b0faf4537e7bf1e60..23d50b6f5dc888c4e7c991227f8fd14e899b0003 100644
--- a/ios/web/navigation/crw_session_controller.mm
+++ b/ios/web/navigation/crw_session_controller.mm
@@ -221,6 +221,10 @@
return [self itemListForEntryList:self.entries];
}
+- (NSUInteger)itemCount {
+ return self.entries.count;
+}
+
- (web::NavigationItemImpl*)currentItem {
return self.currentEntry.navigationItemImpl;
}
@@ -641,14 +645,20 @@
}
- (NSInteger)indexOfItem:(const web::NavigationItem*)item {
- web::NavigationItemList items = self.items;
- for (NSInteger i = 0; i < static_cast<NSInteger>(items.size()); ++i) {
- if (items[i] == item)
- return i;
+ for (NSUInteger index = 0; index < self.entries.count; ++index) {
+ if ([self.entries[index] navigationItem] == item)
+ return static_cast<NSInteger>(index);
}
return NSNotFound;
}
+- (web::NavigationItemImpl*)itemAtIndex:(NSInteger)index {
+ if (index < 0 || self.entries.count <= static_cast<NSUInteger>(index))
+ return nullptr;
+ return static_cast<web::NavigationItemImpl*>(
+ [self.entries[index] navigationItem]);
+}
+
#pragma mark -
#pragma mark Private methods
« no previous file with comments | « ios/web/navigation/crw_session_controller.h ('k') | ios/web/navigation/navigation_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698