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/tab_grid/tab_grid_view_controller.h" | 5 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_view_controller.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.h" | 8 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.h" |
9 #import "ios/clean/chrome/browser/ui/actions/settings_actions.h" | 9 #import "ios/clean/chrome/browser/ui/actions/settings_actions.h" |
10 #import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h" | 10 #import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h" |
11 #import "ios/clean/chrome/browser/ui/commands/settings_commands.h" | 11 #import "ios/clean/chrome/browser/ui/commands/settings_commands.h" |
12 #import "ios/clean/chrome/browser/ui/commands/tab_grid_commands.h" | 12 #import "ios/clean/chrome/browser/ui/commands/tab_grid_commands.h" |
13 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" | 13 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" |
14 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_data_source.h
" | |
15 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_tab_cell.h" | 14 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_tab_cell.h" |
16 #import "ios/clean/chrome/browser/ui/tab_grid/mdc_floating_button+cr_tab_grid.h" | 15 #import "ios/clean/chrome/browser/ui/tab_grid/mdc_floating_button+cr_tab_grid.h" |
17 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_collection_view_layout.h" | 16 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_collection_view_layout.h" |
18 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.h" | 17 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_toolbar.h" |
19 | 18 |
20 #if !defined(__has_feature) || !__has_feature(objc_arc) | 19 #if !defined(__has_feature) || !__has_feature(objc_arc) |
21 #error "This file requires ARC support." | 20 #error "This file requires ARC support." |
22 #endif | 21 #endif |
23 | 22 |
24 @interface TabGridViewController ()<SettingsActions, TabGridActions> | 23 @interface TabGridViewController ()<SettingsActions, TabGridActions> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 [NSLayoutConstraint activateConstraints:@[ | 58 [NSLayoutConstraint activateConstraints:@[ |
60 [self.toolbar.topAnchor constraintEqualToAnchor:self.view.topAnchor], | 59 [self.toolbar.topAnchor constraintEqualToAnchor:self.view.topAnchor], |
61 [self.toolbar.heightAnchor | 60 [self.toolbar.heightAnchor |
62 constraintEqualToAnchor:self.topLayoutGuide.heightAnchor | 61 constraintEqualToAnchor:self.topLayoutGuide.heightAnchor |
63 constant:self.toolbar.intrinsicContentSize.height], | 62 constant:self.toolbar.intrinsicContentSize.height], |
64 [self.toolbar.leadingAnchor | 63 [self.toolbar.leadingAnchor |
65 constraintEqualToAnchor:self.view.leadingAnchor], | 64 constraintEqualToAnchor:self.view.leadingAnchor], |
66 [self.toolbar.trailingAnchor | 65 [self.toolbar.trailingAnchor |
67 constraintEqualToAnchor:self.view.trailingAnchor] | 66 constraintEqualToAnchor:self.view.trailingAnchor] |
68 ]]; | 67 ]]; |
| 68 |
| 69 if (self.items.count == 0) { |
| 70 [self addNoTabsOverlay]; |
| 71 } |
69 } | 72 } |
70 | 73 |
71 - (void)viewWillAppear:(BOOL)animated { | 74 - (void)viewWillAppear:(BOOL)animated { |
72 [super viewWillAppear:animated]; | 75 [super viewWillAppear:animated]; |
73 MDCFloatingButton* floatingNewTabButton = | 76 MDCFloatingButton* floatingNewTabButton = |
74 [MDCFloatingButton cr_tabGridNewTabButton]; | 77 [MDCFloatingButton cr_tabGridNewTabButton]; |
75 self.floatingNewTabButton = floatingNewTabButton; | 78 self.floatingNewTabButton = floatingNewTabButton; |
76 [self.floatingNewTabButton | 79 [self.floatingNewTabButton |
77 setFrame:[MDCFloatingButton | 80 setFrame:[MDCFloatingButton |
78 cr_frameForTabGridNewTabButtonInRect:self.view.bounds]]; | 81 cr_frameForTabGridNewTabButtonInRect:self.view.bounds]]; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; | 148 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; |
146 [self.tabs addSubview:overlayView]; | 149 [self.tabs addSubview:overlayView]; |
147 self.noTabsOverlay = overlayView; | 150 self.noTabsOverlay = overlayView; |
148 } | 151 } |
149 | 152 |
150 - (void)removeNoTabsOverlay { | 153 - (void)removeNoTabsOverlay { |
151 [self.noTabsOverlay removeFromSuperview]; | 154 [self.noTabsOverlay removeFromSuperview]; |
152 } | 155 } |
153 | 156 |
154 @end | 157 @end |
OLD | NEW |