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

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: added dependencies to BUILD.gn 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 #include "ios/chrome/browser/web/navigation_manager_util.h"
Eugene But (OOO till 7-30) 2017/03/17 14:32:04 s/include/import
pkl (ping after 24h if needed) 2017/03/17 20:23:53 Done.
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

Powered by Google App Engine
This is Rietveld 408576698