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

Unified Diff: ios/chrome/browser/tabs/tab.mm

Issue 2915303002: Added NavigationManager::GetIndexOfItem(). (Closed)
Patch Set: 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
Index: ios/chrome/browser/tabs/tab.mm
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm
index 02a6e5223b3406acf0d20f905cd4cce04c3afacf..7584a08126494f875eb2c325c02351707ec82809 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -108,7 +108,6 @@
#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h"
#import "ios/public/provider/chrome/browser/native_app_launcher/native_app_whitelist_manager.h"
-#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/public/favicon_status.h"
@@ -1076,14 +1075,10 @@ - (BOOL)canGoForward {
- (void)goToItem:(const web::NavigationItem*)item {
DCHECK(item);
-
- if (self.navigationManager) {
- CRWSessionController* sessionController =
- [self navigationManagerImpl]->GetSessionController();
- NSInteger itemIndex = [sessionController indexOfItem:item];
- DCHECK_NE(itemIndex, NSNotFound);
- self.navigationManager->GoToIndex(itemIndex);
- }
+ DCHECK(self.navigationManager);
Eugene But (OOO till 7-30) 2017/06/02 18:08:08 No need to DCHECK before dereferencing the pointer
kkhorimoto 2017/06/02 18:28:58 Done.
+ int index = self.navigationManager->GetIndexOfItem(item);
+ DCHECK_NE(index, NSNotFound);
Eugene But (OOO till 7-30) 2017/06/02 18:08:08 NSNotFound is NSInteger, so it will never be equal
kkhorimoto 2017/06/02 18:28:58 Done.
+ self.navigationManager->GoToIndex(index);
}
- (BOOL)openExternalURL:(const GURL&)url

Powered by Google App Engine
This is Rietveld 408576698