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

Side by Side Diff: ios/chrome/browser/web/navigation_manager_util.mm

Issue 2766063002: Remove the concept of currentItemIndex (Closed)
Patch Set: fix unit tests Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/web/navigation_manager_util.h" 5 #import "ios/chrome/browser/web/navigation_manager_util.h"
6 6
7 #if !defined(__has_feature) || !__has_feature(objc_arc) 7 #if !defined(__has_feature) || !__has_feature(objc_arc)
8 #error "This file requires ARC support." 8 #error "This file requires ARC support."
9 #endif 9 #endif
10 10
11 web::NavigationItem* GetLastNonRedirectedItem( 11 web::NavigationItem* GetLastNonRedirectedItem(
12 web::NavigationManager* nav_manager) { 12 web::NavigationManager* nav_manager) {
13 if (!nav_manager || !nav_manager->GetItemCount()) 13 if (!nav_manager || !nav_manager->GetItemCount())
14 return nullptr; 14 return nullptr;
15 int index = nav_manager->GetCurrentItemIndex(); 15 int index = nav_manager->GetLastCommittedItemIndex();
16 web::NavigationItem* item = nullptr; 16 web::NavigationItem* item = nullptr;
17 while (index >= 0) { 17 while (index >= 0) {
18 item = nav_manager->GetItemAtIndex(index); 18 item = nav_manager->GetItemAtIndex(index);
19 // Returns the first non-Redirect item found. 19 // Returns the first non-Redirect item found.
20 if ((item->GetTransitionType() & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0) 20 if ((item->GetTransitionType() & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0)
21 break; 21 break;
22 --index; 22 --index;
23 } 23 }
24 return item; 24 return item;
25 } 25 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.mm ('k') | ios/shared/chrome/browser/tabs/web_state_list.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698