OLD | NEW |
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_view_controller.h" | 5 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" |
6 | 6 |
7 #import "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
8 #import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h" | 8 #import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h" |
9 #import "ios/clean/chrome/browser/ui/actions/tab_strip_actions.h" | 9 #import "ios/clean/chrome/browser/ui/actions/tab_strip_actions.h" |
10 #import "ios/clean/chrome/browser/ui/commands/navigation_commands.h" | 10 #import "ios/clean/chrome/browser/ui/commands/navigation_commands.h" |
| 11 #import "ios/clean/chrome/browser/ui/commands/tab_grid_commands.h" |
11 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" | 12 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" |
12 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h" | 13 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h" |
13 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_component_options.h" | 14 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_component_options.h" |
14 | 15 |
15 #if !defined(__has_feature) || !__has_feature(objc_arc) | 16 #if !defined(__has_feature) || !__has_feature(objc_arc) |
16 #error "This file requires ARC support." | 17 #error "This file requires ARC support." |
17 #endif | 18 #endif |
18 | 19 |
19 namespace { | 20 namespace { |
20 // Stackview Vertical Margin. | 21 // Stackview Vertical Margin. |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 277 } |
277 | 278 |
278 - (void)stop:(id)sender { | 279 - (void)stop:(id)sender { |
279 [self.dispatcher stopLoadingPage]; | 280 [self.dispatcher stopLoadingPage]; |
280 } | 281 } |
281 | 282 |
282 - (void)reload:(id)sender { | 283 - (void)reload:(id)sender { |
283 [self.dispatcher reloadPage]; | 284 [self.dispatcher reloadPage]; |
284 } | 285 } |
285 | 286 |
| 287 - (void)showTabGrid:(id)sender { |
| 288 [self.dispatcher showTabGrid]; |
| 289 } |
| 290 |
286 #pragma mark - TabStripEvents | 291 #pragma mark - TabStripEvents |
287 | 292 |
288 - (void)tabStripDidShow:(id)sender { | 293 - (void)tabStripDidShow:(id)sender { |
289 self.tabSwitchStripButton.hiddenInCurrentState = YES; | 294 self.tabSwitchStripButton.hiddenInCurrentState = YES; |
290 self.tabSwitchGridButton.hiddenInCurrentState = NO; | 295 self.tabSwitchGridButton.hiddenInCurrentState = NO; |
291 [self updateAllButtonsVisibility]; | 296 [self updateAllButtonsVisibility]; |
292 } | 297 } |
293 | 298 |
294 - (void)tabStripDidHide:(id)sender { | 299 - (void)tabStripDidHide:(id)sender { |
295 self.tabSwitchStripButton.hiddenInCurrentState = NO; | 300 self.tabSwitchStripButton.hiddenInCurrentState = NO; |
296 self.tabSwitchGridButton.hiddenInCurrentState = YES; | 301 self.tabSwitchGridButton.hiddenInCurrentState = YES; |
297 [self updateAllButtonsVisibility]; | 302 [self updateAllButtonsVisibility]; |
298 } | 303 } |
299 | 304 |
300 #pragma mark - Helper Methods | 305 #pragma mark - Helper Methods |
301 | 306 |
302 // Updates all Buttons visibility to match any recent WebState change. | 307 // Updates all Buttons visibility to match any recent WebState change. |
303 - (void)updateAllButtonsVisibility { | 308 - (void)updateAllButtonsVisibility { |
304 for (UIView* view in self.stackView.arrangedSubviews) { | 309 for (UIView* view in self.stackView.arrangedSubviews) { |
305 if ([view isKindOfClass:[ToolbarButton class]]) { | 310 if ([view isKindOfClass:[ToolbarButton class]]) { |
306 ToolbarButton* button = base::mac::ObjCCastStrict<ToolbarButton>(view); | 311 ToolbarButton* button = base::mac::ObjCCastStrict<ToolbarButton>(view); |
307 [button setHiddenForCurrentStateAndSizeClass]; | 312 [button setHiddenForCurrentStateAndSizeClass]; |
308 } | 313 } |
309 } | 314 } |
310 } | 315 } |
311 | 316 |
312 @end | 317 @end |
OLD | NEW |