Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/web/navigation/crw_session_controller.h" | 5 #import "ios/web/navigation/crw_session_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 return index == -1 ? nullptr : self.items[index].get(); | 195 return index == -1 ? nullptr : self.items[index].get(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 - (web::NavigationItemImpl*)previousItem { | 198 - (web::NavigationItemImpl*)previousItem { |
| 199 NSInteger index = self.previousItemIndex; | 199 NSInteger index = self.previousItemIndex; |
| 200 return index == -1 || self.items.empty() ? nullptr : self.items[index].get(); | 200 return index == -1 || self.items.empty() ? nullptr : self.items[index].get(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 - (web::NavigationItemList)backwardItems { | 203 - (web::NavigationItemList)backwardItems { |
| 204 web::NavigationItemList items; | 204 web::NavigationItemList items; |
| 205 | |
| 206 // If the current navigation item is a transient item (e.g. SSL interstitial), | |
| 207 // the last committed item should also be considered part of the backward | |
| 208 // history. | |
| 209 if (self.transientItem) { | |
| 210 items.push_back(self.items[_lastCommittedItemIndex].get()); | |
|
kkhorimoto
2017/04/26 10:50:37
Optional nit: items.push_back(self.lastCommittedIt
| |
| 211 } | |
| 212 | |
| 205 for (size_t index = _lastCommittedItemIndex; index > 0; --index) { | 213 for (size_t index = _lastCommittedItemIndex; index > 0; --index) { |
| 206 if (![self isRedirectTransitionForItemAtIndex:index]) | 214 if (![self isRedirectTransitionForItemAtIndex:index]) |
| 207 items.push_back(self.items[index - 1].get()); | 215 items.push_back(self.items[index - 1].get()); |
| 208 } | 216 } |
| 209 return items; | 217 return items; |
| 210 } | 218 } |
| 211 | 219 |
| 212 - (web::NavigationItemList)forwardItems { | 220 - (web::NavigationItemList)forwardItems { |
| 213 web::NavigationItemList items; | 221 web::NavigationItemList items; |
| 214 NSUInteger lastNonRedirectedIndex = _lastCommittedItemIndex + 1; | 222 NSUInteger lastNonRedirectedIndex = _lastCommittedItemIndex + 1; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 return item; | 665 return item; |
| 658 } | 666 } |
| 659 | 667 |
| 660 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { | 668 - (BOOL)isRedirectTransitionForItemAtIndex:(size_t)index { |
| 661 DCHECK_LT(index, self.items.size()); | 669 DCHECK_LT(index, self.items.size()); |
| 662 ui::PageTransition transition = self.items[index]->GetTransitionType(); | 670 ui::PageTransition transition = self.items[index]->GetTransitionType(); |
| 663 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; | 671 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; |
| 664 } | 672 } |
| 665 | 673 |
| 666 @end | 674 @end |
| OLD | NEW |