| 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 | 592 |
| 593 _previousNavigationIndex = -1; | 593 _previousNavigationIndex = -1; |
| 594 _currentNavigationIndex += lastIndexToCopy + 1; | 594 _currentNavigationIndex += lastIndexToCopy + 1; |
| 595 if (_pendingEntryIndex != -1) | 595 if (_pendingEntryIndex != -1) |
| 596 _pendingEntryIndex += lastIndexToCopy + 1; | 596 _pendingEntryIndex += lastIndexToCopy + 1; |
| 597 | 597 |
| 598 DCHECK_LT(static_cast<NSUInteger>(_currentNavigationIndex), _entries.count); | 598 DCHECK_LT(static_cast<NSUInteger>(_currentNavigationIndex), _entries.count); |
| 599 DCHECK(_pendingEntryIndex == -1 || _pendingEntry); | 599 DCHECK(_pendingEntryIndex == -1 || _pendingEntry); |
| 600 } | 600 } |
| 601 | 601 |
| 602 - (BOOL)canGoDelta:(int)delta { | |
| 603 NSInteger index = [self indexOfEntryForDelta:delta]; | |
| 604 return 0 <= index && static_cast<NSUInteger>(index) < _entries.count; | |
| 605 } | |
| 606 | |
| 607 - (void)goToEntryAtIndex:(NSInteger)index { | 602 - (void)goToEntryAtIndex:(NSInteger)index { |
| 608 if (index < 0 || static_cast<NSUInteger>(index) >= _entries.count) | 603 if (index < 0 || static_cast<NSUInteger>(index) >= _entries.count) |
| 609 return; | 604 return; |
| 610 | 605 |
| 611 if (index < _currentNavigationIndex) { | 606 if (index < _currentNavigationIndex) { |
| 612 // Going back. | 607 // Going back. |
| 613 [self discardNonCommittedEntries]; | 608 [self discardNonCommittedEntries]; |
| 614 } else if (_currentNavigationIndex < index) { | 609 } else if (_currentNavigationIndex < index) { |
| 615 // Going forward. | 610 // Going forward. |
| 616 [self discardTransientEntry]; | 611 [self discardTransientEntry]; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]; | 822 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]; |
| 828 } | 823 } |
| 829 | 824 |
| 830 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index { | 825 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index { |
| 831 ui::PageTransition transition = | 826 ui::PageTransition transition = |
| 832 [_entries[index] navigationItem]->GetTransitionType(); | 827 [_entries[index] navigationItem]->GetTransitionType(); |
| 833 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; | 828 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; |
| 834 } | 829 } |
| 835 | 830 |
| 836 @end | 831 @end |
| OLD | NEW |