| 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 // ====== New Architecture ===== | 5 // ====== New Architecture ===== |
| 6 // = This code is only used in the new iOS Chrome architecture. = | 6 // = This code is only used in the new iOS Chrome architecture. = |
| 7 // ============================================================================ | 7 // ============================================================================ |
| 8 | 8 |
| 9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" | 9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 constant:kVerticalMargin], | 77 constant:kVerticalMargin], |
| 78 [self.stackView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor | 78 [self.stackView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor |
| 79 constant:-kVerticalMargin], | 79 constant:-kVerticalMargin], |
| 80 [self.stackView.leadingAnchor | 80 [self.stackView.leadingAnchor |
| 81 constraintEqualToAnchor:self.view.layoutMarginsGuide.leadingAnchor], | 81 constraintEqualToAnchor:self.view.layoutMarginsGuide.leadingAnchor], |
| 82 [self.stackView.trailingAnchor | 82 [self.stackView.trailingAnchor |
| 83 constraintEqualToAnchor:self.view.layoutMarginsGuide.trailingAnchor], | 83 constraintEqualToAnchor:self.view.layoutMarginsGuide.trailingAnchor], |
| 84 ]]; | 84 ]]; |
| 85 } | 85 } |
| 86 | 86 |
| 87 - (void)viewWillLayoutSubviews { |
| 88 // This forces the ToolMenu to close whenever a Device Rotation, iPad |
| 89 // Multitasking change, etc. happens. |
| 90 [self.toolbarCommandHandler closeToolsMenu]; |
| 91 } |
| 92 |
| 87 #pragma mark - Components Setup | 93 #pragma mark - Components Setup |
| 88 | 94 |
| 89 - (void)setUpToolbarButtons { | 95 - (void)setUpToolbarButtons { |
| 90 // Back button. | 96 // Back button. |
| 91 self.backButton = [ToolbarButton backToolbarButton]; | 97 self.backButton = [ToolbarButton backToolbarButton]; |
| 92 self.backButton.visibilityMask = ToolbarComponentVisibilityCompactWidth | | 98 self.backButton.visibilityMask = ToolbarComponentVisibilityCompactWidth | |
| 93 ToolbarComponentVisibilityRegularWidth; | 99 ToolbarComponentVisibilityRegularWidth; |
| 94 [self.backButton addTarget:nil | 100 [self.backButton addTarget:nil |
| 95 action:@selector(goBack:) | 101 action:@selector(goBack:) |
| 96 forControlEvents:UIControlEventTouchUpInside]; | 102 forControlEvents:UIControlEventTouchUpInside]; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 - (void)updateAllButtonsVisibility { | 198 - (void)updateAllButtonsVisibility { |
| 193 for (UIView* view in self.stackView.arrangedSubviews) { | 199 for (UIView* view in self.stackView.arrangedSubviews) { |
| 194 if ([view isKindOfClass:[ToolbarButton class]]) { | 200 if ([view isKindOfClass:[ToolbarButton class]]) { |
| 195 ToolbarButton* button = base::mac::ObjCCastStrict<ToolbarButton>(view); | 201 ToolbarButton* button = base::mac::ObjCCastStrict<ToolbarButton>(view); |
| 196 [button setHiddenForCurrentStateAndSizeClass]; | 202 [button setHiddenForCurrentStateAndSizeClass]; |
| 197 } | 203 } |
| 198 } | 204 } |
| 199 } | 205 } |
| 200 | 206 |
| 201 @end | 207 @end |
| OLD | NEW |