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

Side by Side Diff: ios/chrome/browser/tabs/tab.mm

Issue 2915303002: Added NavigationManager::GetIndexOfItem(). (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/tabs/tab.h" 5 #import "ios/chrome/browser/tabs/tab.h"
6 6
7 #import <CoreLocation/CoreLocation.h> 7 #import <CoreLocation/CoreLocation.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #import "ios/chrome/browser/web/auto_reload_bridge.h" 101 #import "ios/chrome/browser/web/auto_reload_bridge.h"
102 #import "ios/chrome/browser/web/external_app_launcher.h" 102 #import "ios/chrome/browser/web/external_app_launcher.h"
103 #import "ios/chrome/browser/web/navigation_manager_util.h" 103 #import "ios/chrome/browser/web/navigation_manager_util.h"
104 #import "ios/chrome/browser/web/passkit_dialog_provider.h" 104 #import "ios/chrome/browser/web/passkit_dialog_provider.h"
105 #include "ios/chrome/browser/web/print_observer.h" 105 #include "ios/chrome/browser/web/print_observer.h"
106 #import "ios/chrome/browser/xcallback_parameters.h" 106 #import "ios/chrome/browser/xcallback_parameters.h"
107 #include "ios/chrome/grit/ios_strings.h" 107 #include "ios/chrome/grit/ios_strings.h"
108 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 108 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
109 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metad ata.h" 109 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metad ata.h"
110 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white list_manager.h" 110 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white list_manager.h"
111 #import "ios/web/navigation/crw_session_controller.h"
112 #import "ios/web/navigation/navigation_item_impl.h" 111 #import "ios/web/navigation/navigation_item_impl.h"
113 #import "ios/web/navigation/navigation_manager_impl.h" 112 #import "ios/web/navigation/navigation_manager_impl.h"
114 #include "ios/web/public/favicon_status.h" 113 #include "ios/web/public/favicon_status.h"
115 #include "ios/web/public/favicon_url.h" 114 #include "ios/web/public/favicon_url.h"
116 #include "ios/web/public/interstitials/web_interstitial.h" 115 #include "ios/web/public/interstitials/web_interstitial.h"
117 #include "ios/web/public/load_committed_details.h" 116 #include "ios/web/public/load_committed_details.h"
118 #import "ios/web/public/navigation_manager.h" 117 #import "ios/web/public/navigation_manager.h"
119 #include "ios/web/public/referrer.h" 118 #include "ios/web/public/referrer.h"
120 #import "ios/web/public/serializable_user_data_manager.h" 119 #import "ios/web/public/serializable_user_data_manager.h"
121 #include "ios/web/public/ssl_status.h" 120 #include "ios/web/public/ssl_status.h"
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 - (BOOL)canGoBack { 1068 - (BOOL)canGoBack {
1070 return self.navigationManager && self.navigationManager->CanGoBack(); 1069 return self.navigationManager && self.navigationManager->CanGoBack();
1071 } 1070 }
1072 1071
1073 - (BOOL)canGoForward { 1072 - (BOOL)canGoForward {
1074 return self.navigationManager && self.navigationManager->CanGoForward(); 1073 return self.navigationManager && self.navigationManager->CanGoForward();
1075 } 1074 }
1076 1075
1077 - (void)goToItem:(const web::NavigationItem*)item { 1076 - (void)goToItem:(const web::NavigationItem*)item {
1078 DCHECK(item); 1077 DCHECK(item);
1079 1078 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.
1080 if (self.navigationManager) { 1079 int index = self.navigationManager->GetIndexOfItem(item);
1081 CRWSessionController* sessionController = 1080 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.
1082 [self navigationManagerImpl]->GetSessionController(); 1081 self.navigationManager->GoToIndex(index);
1083 NSInteger itemIndex = [sessionController indexOfItem:item];
1084 DCHECK_NE(itemIndex, NSNotFound);
1085 self.navigationManager->GoToIndex(itemIndex);
1086 }
1087 } 1082 }
1088 1083
1089 - (BOOL)openExternalURL:(const GURL&)url 1084 - (BOOL)openExternalURL:(const GURL&)url
1090 sourceURL:(const GURL&)sourceURL 1085 sourceURL:(const GURL&)sourceURL
1091 linkClicked:(BOOL)linkClicked { 1086 linkClicked:(BOOL)linkClicked {
1092 if (!_externalAppLauncher) 1087 if (!_externalAppLauncher)
1093 _externalAppLauncher = [[ExternalAppLauncher alloc] init]; 1088 _externalAppLauncher = [[ExternalAppLauncher alloc] init];
1094 1089
1095 // Make a local url copy for possible modification. 1090 // Make a local url copy for possible modification.
1096 GURL finalURL = url; 1091 GURL finalURL = url;
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 1896
1902 - (TabModel*)parentTabModel { 1897 - (TabModel*)parentTabModel {
1903 return _parentTabModel; 1898 return _parentTabModel;
1904 } 1899 }
1905 1900
1906 - (FormInputAccessoryViewController*)inputAccessoryViewController { 1901 - (FormInputAccessoryViewController*)inputAccessoryViewController {
1907 return _inputAccessoryViewController; 1902 return _inputAccessoryViewController;
1908 } 1903 }
1909 1904
1910 @end 1905 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698