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

Side by Side Diff: ios/web/navigation/crw_session_controller.mm

Issue 2491773005: [ios] Removed canGoBack/canGoForward API from CRWSessionController. (Closed)
Patch Set: Fixed compilation. Created 4 years, 1 month 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
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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 self.currentNavigationIndex = [otherSession currentNavigationIndex]; 619 self.currentNavigationIndex = [otherSession currentNavigationIndex];
620 _previousNavigationIndex = [otherSession previousNavigationIndex]; 620 _previousNavigationIndex = [otherSession previousNavigationIndex];
621 } else { 621 } else {
622 self.currentNavigationIndex = maxCopyIndex; 622 self.currentNavigationIndex = maxCopyIndex;
623 } 623 }
624 } 624 }
625 DCHECK_LT((NSUInteger)_currentNavigationIndex, [_entries count]); 625 DCHECK_LT((NSUInteger)_currentNavigationIndex, [_entries count]);
626 DCHECK(_pendingEntryIndex == -1 || _pendingEntry); 626 DCHECK(_pendingEntryIndex == -1 || _pendingEntry);
627 } 627 }
628 628
629 - (BOOL)canGoBack {
630 return [self canGoDelta:-1];
631 }
632
633 - (BOOL)canGoForward {
634 return [self canGoDelta:1];
635 }
636
637 - (BOOL)canGoDelta:(int)delta { 629 - (BOOL)canGoDelta:(int)delta {
638 NSInteger index = [self indexOfEntryForDelta:delta]; 630 NSInteger index = [self indexOfEntryForDelta:delta];
639 return 0 <= index && static_cast<NSUInteger>(index) < _entries.count; 631 return 0 <= index && static_cast<NSUInteger>(index) < _entries.count;
640 } 632 }
641 633
642 - (void)goDelta:(int)delta { 634 - (void)goDelta:(int)delta {
643 if (delta != 0 && [self canGoDelta:delta]) { 635 if (delta != 0 && [self canGoDelta:delta]) {
644 NSInteger newNavigationIndex = [self indexOfEntryForDelta:delta]; 636 NSInteger newNavigationIndex = [self indexOfEntryForDelta:delta];
645 [self goToEntry:_entries[newNavigationIndex]]; 637 [self goToEntry:_entries[newNavigationIndex]];
646 } 638 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]; 868 return [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)];
877 } 869 }
878 870
879 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index { 871 - (BOOL)isRedirectTransitionForEntryAtIndex:(NSInteger)index {
880 ui::PageTransition transition = 872 ui::PageTransition transition =
881 [_entries[index] navigationItem]->GetTransitionType(); 873 [_entries[index] navigationItem]->GetTransitionType();
882 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO; 874 return (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) ? YES : NO;
883 } 875 }
884 876
885 @end 877 @end
OLDNEW
« no previous file with comments | « ios/web/navigation/crw_session_controller.h ('k') | ios/web/navigation/crw_session_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698