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

Side by Side Diff: ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.mm

Issue 2809563002: [ios clean] Fixes Toolbar navigation crash. (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/clean/chrome/browser/ui/toolbar/toolbar_coordinator.h" 5 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.h"
6 6
7 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" 7 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h"
8 #import "ios/clean/chrome/browser/ui/omnibox/location_bar_coordinator.h" 8 #import "ios/clean/chrome/browser/ui/omnibox/location_bar_coordinator.h"
9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_mediator.h" 9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_mediator.h"
10 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" 10 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 - (void)closeToolsMenu { 107 - (void)closeToolsMenu {
108 [self.toolsMenuCoordinator stop]; 108 [self.toolsMenuCoordinator stop];
109 [self removeChildCoordinator:self.toolsMenuCoordinator]; 109 [self removeChildCoordinator:self.toolsMenuCoordinator];
110 } 110 }
111 111
112 // PLACEHOLDER: These will move to an object that handles navigation. 112 // PLACEHOLDER: These will move to an object that handles navigation.
113 #pragma mark - NavigationCommands 113 #pragma mark - NavigationCommands
114 114
115 - (void)goBack { 115 - (void)goBack {
116 self.webState->GetNavigationManager()->GoBack(); 116 if (self.webState->GetNavigationManager()->CanGoBack()) {
117 self.webState->GetNavigationManager()->GoBack();
edchin 2017/04/10 05:13:15 I wonder if the GoBack() method should simply no-o
marq (ping after 24h) 2017/04/10 11:14:09 If it's a programming error to call GoBack() when
rohitrao (ping after 24h) 2017/04/10 12:47:03 I would prefer that GoBack() fail loudly if CanGoB
118 }
117 } 119 }
118 120
119 - (void)goForward { 121 - (void)goForward {
120 self.webState->GetNavigationManager()->GoForward(); 122 if (self.webState->GetNavigationManager()->CanGoForward()) {
123 self.webState->GetNavigationManager()->GoForward();
124 }
121 } 125 }
122 126
123 - (void)stopLoadingPage { 127 - (void)stopLoadingPage {
124 self.webState->Stop(); 128 self.webState->Stop();
125 } 129 }
126 130
127 - (void)reloadPage { 131 - (void)reloadPage {
128 self.webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL, 132 self.webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
129 false /*check_for_repost*/); 133 false /*check_for_repost*/);
130 } 134 }
131 135
132 @end 136 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698