Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 } | |
| OLD | NEW |