Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: ios/clean/chrome/browser/ui/tab_grid/mdc_floating_button+cr_tab_grid.mm

Issue 2699223003: [tab_grid] Hack-in new tab FAB action. (Closed)
Patch Set: Address comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/mdc_floating_button+cr_tab_grid.h" 5 #import "ios/clean/chrome/browser/ui/tab_grid/mdc_floating_button+cr_tab_grid.h"
6 6
7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 7 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
8 #include "ios/chrome/browser/ui/rtl_geometry.h" 8 #include "ios/chrome/browser/ui/rtl_geometry.h"
9 #include "ios/chrome/grit/ios_strings.h" 9 #include "ios/chrome/grit/ios_strings.h"
10 #import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h"
10 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 11 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 13
13 #if !defined(__has_feature) || !__has_feature(objc_arc) 14 #if !defined(__has_feature) || !__has_feature(objc_arc)
14 #error "This file requires ARC support." 15 #error "This file requires ARC support."
15 #endif 16 #endif
16 17
17 namespace { 18 namespace {
18 // Margin from trailing and bottom edges. 19 // Margin from trailing and bottom edges.
19 const CGFloat kNewTabButtonMarginFromEdges = 48; 20 const CGFloat kNewTabButtonMarginFromEdges = 48;
(...skipping 15 matching lines...) Expand all
35 [button setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin | 36 [button setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin |
36 UIViewAutoresizingFlexibleLeadingMargin()]; 37 UIViewAutoresizingFlexibleLeadingMargin()];
37 38
38 MDCPalette* palette = [MDCPalette cr_bluePalette]; 39 MDCPalette* palette = [MDCPalette cr_bluePalette];
39 [button setInkColor:[[palette tint300] colorWithAlphaComponent:0.5f]]; 40 [button setInkColor:[[palette tint300] colorWithAlphaComponent:0.5f]];
40 [button setBackgroundColor:[palette tint500] forState:UIControlStateNormal]; 41 [button setBackgroundColor:[palette tint500] forState:UIControlStateNormal];
41 [button setBackgroundColor:[UIColor colorWithWhite:0.8f alpha:1.0f] 42 [button setBackgroundColor:[UIColor colorWithWhite:0.8f alpha:1.0f]
42 forState:UIControlStateDisabled]; 43 forState:UIControlStateDisabled];
43 [button setAccessibilityLabel:l10n_util::GetNSString( 44 [button setAccessibilityLabel:l10n_util::GetNSString(
44 IDS_IOS_TAB_SWITCHER_CREATE_NEW_TAB)]; 45 IDS_IOS_TAB_SWITCHER_CREATE_NEW_TAB)];
46 [button addTarget:nil
47 action:@selector(createNewTab:)
48 forControlEvents:UIControlEventTouchUpInside];
45 } 49 }
46 return button; 50 return button;
47 } 51 }
48 52
49 + (CGRect)cr_frameForTabGridNewTabButtonInRect:(CGRect)rect { 53 + (CGRect)cr_frameForTabGridNewTabButtonInRect:(CGRect)rect {
50 CGFloat yOrigin = CGRectGetHeight(rect) - kNewTabButtonMarginFromEdges - 54 CGFloat yOrigin = CGRectGetHeight(rect) - kNewTabButtonMarginFromEdges -
51 kNewTabButtonDiameter; 55 kNewTabButtonDiameter;
52 CGFloat leading = CGRectGetWidth(rect) - kNewTabButtonMarginFromEdges - 56 CGFloat leading = CGRectGetWidth(rect) - kNewTabButtonMarginFromEdges -
53 kNewTabButtonDiameter; 57 kNewTabButtonDiameter;
54 LayoutRect buttonLayout = 58 LayoutRect buttonLayout =
55 LayoutRectMake(leading, CGRectGetWidth(rect), yOrigin, 59 LayoutRectMake(leading, CGRectGetWidth(rect), yOrigin,
56 kNewTabButtonDiameter, kNewTabButtonDiameter); 60 kNewTabButtonDiameter, kNewTabButtonDiameter);
57 return LayoutRectGetRect(buttonLayout); 61 return LayoutRectGetRect(buttonLayout);
58 } 62 }
59 63
60 @end 64 @end
OLDNEW
« no previous file with comments | « ios/clean/chrome/browser/ui/commands/tab_commands.h ('k') | ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698