| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ntp/new_tab_page_toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
| 10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 base::scoped_nsobject<GenericChromeCommand> command( | 199 base::scoped_nsobject<GenericChromeCommand> command( |
| 200 [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_FORWARD_HISTORY]); | 200 [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_FORWARD_HISTORY]); |
| 201 [_forwardButton chromeExecuteCommand:command]; | 201 [_forwardButton chromeExecuteCommand:command]; |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 - (void)hideViewsForNewTabPage:(BOOL)hide { | 205 - (void)hideViewsForNewTabPage:(BOOL)hide { |
| 206 [super hideViewsForNewTabPage:hide]; | 206 [super hideViewsForNewTabPage:hide]; |
| 207 // Show the back/forward buttons if there is forward history. | 207 // Show the back/forward buttons if there is forward history. |
| 208 ToolbarModelIOS* toolbarModelIOS = [_delegate toolbarModelIOS]; | 208 ToolbarModelIOS* toolbarModelIOS = [_delegate toolbarModelIOS]; |
| 209 BOOL forwardEnabled = toolbarModelIOS->CanGoForward(); | 209 if (toolbarModelIOS) { |
| 210 [_backButton setHidden:!forwardEnabled && hide]; | 210 BOOL forwardEnabled = toolbarModelIOS->CanGoForward(); |
| 211 [_backButton setEnabled:toolbarModelIOS->CanGoBack()]; | 211 [_backButton setHidden:!forwardEnabled && hide]; |
| 212 [_forwardButton setHidden:!forwardEnabled && hide]; | 212 [_backButton setEnabled:toolbarModelIOS->CanGoBack()]; |
| 213 [_forwardButton setHidden:!forwardEnabled && hide]; |
| 214 } |
| 213 } | 215 } |
| 214 | 216 |
| 215 - (void)focusOmnibox:(id)sender { | 217 - (void)focusOmnibox:(id)sender { |
| 216 [_focuser focusFakebox]; | 218 [_focuser focusFakebox]; |
| 217 } | 219 } |
| 218 | 220 |
| 219 - (IBAction)stackButtonTouchDown:(id)sender { | 221 - (IBAction)stackButtonTouchDown:(id)sender { |
| 220 [_delegate prepareToEnterTabSwitcher:self]; | 222 [_delegate prepareToEnterTabSwitcher:self]; |
| 221 } | 223 } |
| 222 | 224 |
| 223 @end | 225 @end |
| OLD | NEW |