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

Side by Side Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2631733002: Avoid sending IDC_BACK/FORWARD when back/forward is not possible (Closed)
Patch Set: Rebased Created 3 years, 11 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
« no previous file with comments | « no previous file | ios/chrome/browser/ui/key_commands_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome/browser/ui/browser_view_controller.h" 5 #import "ios/chrome/browser/ui/browser_view_controller.h"
6 6
7 #import <AssetsLibrary/AssetsLibrary.h> 7 #import <AssetsLibrary/AssetsLibrary.h>
8 #import <MobileCoreServices/MobileCoreServices.h> 8 #import <MobileCoreServices/MobileCoreServices.h>
9 #import <PassKit/PassKit.h> 9 #import <PassKit/PassKit.h>
10 #import <Photos/Photos.h> 10 #import <Photos/Photos.h>
(...skipping 3530 matching lines...) Expand 10 before | Expand all | Expand 10 after
3541 #pragma mark - KeyCommandsPlumbing 3541 #pragma mark - KeyCommandsPlumbing
3542 3542
3543 - (BOOL)isOffTheRecord { 3543 - (BOOL)isOffTheRecord {
3544 return _isOffTheRecord; 3544 return _isOffTheRecord;
3545 } 3545 }
3546 3546
3547 - (NSUInteger)tabsCount { 3547 - (NSUInteger)tabsCount {
3548 return [_model count]; 3548 return [_model count];
3549 } 3549 }
3550 3550
3551 - (BOOL)canGoBack {
3552 return [_model currentTab].canGoBack;
3553 }
3554
3555 - (BOOL)canGoForward {
3556 return [_model currentTab].canGoForward;
3557 }
3558
3551 - (void)focusTabAtIndex:(NSUInteger)index { 3559 - (void)focusTabAtIndex:(NSUInteger)index {
3552 if ([_model count] > index) { 3560 if ([_model count] > index) {
3553 [_model setCurrentTab:[_model tabAtIndex:index]]; 3561 [_model setCurrentTab:[_model tabAtIndex:index]];
3554 } 3562 }
3555 } 3563 }
3556 3564
3557 - (void)focusNextTab { 3565 - (void)focusNextTab {
3558 NSInteger currentTabIndex = [_model indexOfTab:[_model currentTab]]; 3566 NSInteger currentTabIndex = [_model indexOfTab:[_model currentTab]];
3559 NSInteger modelCount = [_model count]; 3567 NSInteger modelCount = [_model count];
3560 if (currentTabIndex < modelCount - 1) { 3568 if (currentTabIndex < modelCount - 1) {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 #pragma mark - Command Handling 3915 #pragma mark - Command Handling
3908 3916
3909 - (IBAction)chromeExecuteCommand:(id)sender { 3917 - (IBAction)chromeExecuteCommand:(id)sender {
3910 NSInteger command = [sender tag]; 3918 NSInteger command = [sender tag];
3911 3919
3912 if (!_model || !_browserState) 3920 if (!_model || !_browserState)
3913 return; 3921 return;
3914 3922
3915 switch (command) { 3923 switch (command) {
3916 case IDC_BACK: 3924 case IDC_BACK:
3917 if ([_model currentTab].canGoBack) { 3925 [[_model currentTab] goBack];
3918 [[_model currentTab] goBack];
3919 }
3920 break; 3926 break;
3921 case IDC_BOOKMARK_PAGE: 3927 case IDC_BOOKMARK_PAGE:
3922 [self initializeBookmarkInteractionController]; 3928 [self initializeBookmarkInteractionController];
3923 [_bookmarkInteractionController 3929 [_bookmarkInteractionController
3924 presentBookmarkForTab:[_model currentTab] 3930 presentBookmarkForTab:[_model currentTab]
3925 currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser() 3931 currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser()
3926 inView:[_toolbarController bookmarkButtonView] 3932 inView:[_toolbarController bookmarkButtonView]
3927 originRect:[_toolbarController bookmarkButtonAnchorRect]]; 3933 originRect:[_toolbarController bookmarkButtonAnchorRect]];
3928 break; 3934 break;
3929 case IDC_CLOSE_TAB: 3935 case IDC_CLOSE_TAB:
(...skipping 20 matching lines...) Expand all
3950 [_findBarController updateResultsCount:model]; 3956 [_findBarController updateResultsCount:model];
3951 }]; 3957 }];
3952 break; 3958 break;
3953 case IDC_FIND_CLOSE: 3959 case IDC_FIND_CLOSE:
3954 [self closeFindInPage]; 3960 [self closeFindInPage];
3955 break; 3961 break;
3956 case IDC_FIND_UPDATE: 3962 case IDC_FIND_UPDATE:
3957 [self searchFindInPage]; 3963 [self searchFindInPage];
3958 break; 3964 break;
3959 case IDC_FORWARD: 3965 case IDC_FORWARD:
3960 if ([_model currentTab].canGoForward) { 3966 [[_model currentTab] goForward];
3961 [[_model currentTab] goForward];
3962 }
3963 break; 3967 break;
3964 case IDC_FULLSCREEN: 3968 case IDC_FULLSCREEN:
3965 NOTIMPLEMENTED(); 3969 NOTIMPLEMENTED();
3966 break; 3970 break;
3967 case IDC_HELP_PAGE_VIA_MENU: 3971 case IDC_HELP_PAGE_VIA_MENU:
3968 [self showHelpPage]; 3972 [self showHelpPage];
3969 break; 3973 break;
3970 case IDC_NEW_TAB: 3974 case IDC_NEW_TAB:
3971 if (_isOffTheRecord) { 3975 if (_isOffTheRecord) {
3972 // Not for this browser state, send it on its way. 3976 // Not for this browser state, send it on its way.
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
5138 5142
5139 - (UIView*)voiceSearchButton { 5143 - (UIView*)voiceSearchButton {
5140 return _voiceSearchButton; 5144 return _voiceSearchButton;
5141 } 5145 }
5142 5146
5143 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5147 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5144 return [self currentLogoAnimationControllerOwner]; 5148 return [self currentLogoAnimationControllerOwner];
5145 } 5149 }
5146 5150
5147 @end 5151 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/key_commands_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698