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

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

Issue 2756483006: Adds NavigationManager util functions to ios/chrome/browser/web/ (Closed)
Patch Set: changed #include to #import and minor renaming. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/web/navigation_manager_util.h"
6
7 #if !defined(__has_feature) || !__has_feature(objc_arc)
8 #error "This file requires ARC support."
9 #endif
10
11 web::NavigationItem* GetLastNonRedirectedItem(
12 web::NavigationManager* nav_manager) {
13 if (!nav_manager->GetItemCount())
14 return nullptr;
15 int index = nav_manager->GetCurrentItemIndex();
16 web::NavigationItem* item = nullptr;
17 while (index >= 0) {
18 item = nav_manager->GetItemAtIndex(index);
19 // Returns the first non-Redirect item found.
20 if ((item->GetTransitionType() & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0)
21 break;
22 --index;
23 }
24 return item;
25 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/web/navigation_manager_util.h ('k') | ios/chrome/browser/web/navigation_manager_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698