| 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/tools/menu_view_controller.h" | 5 #import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #import "base/logging.h" | 8 #import "base/logging.h" |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/macros.h" | 10 #import "base/macros.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 self.view.backgroundColor = [UIColor whiteColor]; | 76 self.view.backgroundColor = [UIColor whiteColor]; |
| 77 self.view.autoresizingMask = UIViewAutoresizingNone; | 77 self.view.autoresizingMask = UIViewAutoresizingNone; |
| 78 self.view.layer.borderColor = [UIColor clearColor].CGColor; | 78 self.view.layer.borderColor = [UIColor clearColor].CGColor; |
| 79 } | 79 } |
| 80 | 80 |
| 81 - (void)viewDidLoad { | 81 - (void)viewDidLoad { |
| 82 self.menuScrollView = [[UIScrollView alloc] init]; | 82 self.menuScrollView = [[UIScrollView alloc] init]; |
| 83 self.menuScrollView.translatesAutoresizingMaskIntoConstraints = NO; | 83 self.menuScrollView.translatesAutoresizingMaskIntoConstraints = NO; |
| 84 [self.view addSubview:self.menuScrollView]; | 84 [self.view addSubview:self.menuScrollView]; |
| 85 | 85 |
| 86 // PLACEHOLDER: Hardcoded value until the mediator observes the Webstate. | |
| 87 self.currentPageLoading = NO; | |
| 88 | |
| 89 [self setupCloseMenuButton]; | 86 [self setupCloseMenuButton]; |
| 90 [self setupMenuStackView]; | 87 [self setupMenuStackView]; |
| 91 [self setupConstraints]; | 88 [self setupConstraints]; |
| 92 } | 89 } |
| 93 | 90 |
| 94 #pragma mark - UI Setup | 91 #pragma mark - UI Setup |
| 95 | 92 |
| 96 - (void)setupCloseMenuButton { | 93 - (void)setupCloseMenuButton { |
| 97 // Add close tools menu button. This button is fixed on the top right corner | 94 // Add close tools menu button. This button is fixed on the top right corner |
| 98 // and will always be visible. | 95 // and will always be visible. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 #pragma mark - Tools Consumer | 243 #pragma mark - Tools Consumer |
| 247 | 244 |
| 248 - (void)setToolsMenuItems:(NSArray*)menuItems { | 245 - (void)setToolsMenuItems:(NSArray*)menuItems { |
| 249 _menuItems = menuItems; | 246 _menuItems = menuItems; |
| 250 } | 247 } |
| 251 | 248 |
| 252 - (void)displayOverflowControls:(BOOL)displayOverflowControls { | 249 - (void)displayOverflowControls:(BOOL)displayOverflowControls { |
| 253 self.displayOverflowControls = displayOverflowControls; | 250 self.displayOverflowControls = displayOverflowControls; |
| 254 } | 251 } |
| 255 | 252 |
| 253 - (void)setIsLoading:(BOOL)isLoading { |
| 254 self.currentPageLoading = isLoading; |
| 255 } |
| 256 |
| 257 - (void)setCurrentPageLoading:(BOOL)currentPageLoading { |
| 258 _currentPageLoading = currentPageLoading; |
| 259 // If the OverflowButtons have been initialized update their visibility. |
| 260 if (self.toolbarOverflowStackView) { |
| 261 self.toolbarOverflowStackView.reloadButton.hidden = currentPageLoading; |
| 262 self.toolbarOverflowStackView.stopButton.hidden = !currentPageLoading; |
| 263 } |
| 264 } |
| 265 |
| 256 @end | 266 @end |
| OLD | NEW |