OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ios/chrome/browser/ui/ntp/recent_tabs/views/panel_bar_view.h" | 5 #include "ios/chrome/browser/ui/ntp/recent_tabs/views/panel_bar_view.h" |
6 | 6 |
7 #import "ios/chrome/browser/ui/ntp/recent_tabs/views/views_utils.h" | 7 #import "ios/chrome/browser/ui/ntp/recent_tabs/views/views_utils.h" |
8 #include "ios/chrome/browser/ui/rtl_geometry.h" | 8 #include "ios/chrome/browser/ui/rtl_geometry.h" |
9 #include "ios/chrome/browser/ui/ui_util.h" | 9 #include "ios/chrome/browser/ui/ui_util.h" |
10 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 10 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
11 #include "ios/chrome/grit/ios_strings.h" | 11 #include "ios/chrome/grit/ios_strings.h" |
12 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" | 12 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
13 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | |
14 #include "ui/base/l10n/l10n_util_mac.h" | 13 #include "ui/base/l10n/l10n_util_mac.h" |
15 | 14 |
16 #if !defined(__has_feature) || !__has_feature(objc_arc) | 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
17 #error "This file requires ARC support." | 16 #error "This file requires ARC support." |
18 #endif | 17 #endif |
19 | 18 |
20 namespace { | 19 namespace { |
21 | 20 |
22 const int kBackgroundColor = 0xf2f2f2; | 21 const int kBackgroundColor = 0xf2f2f2; |
23 const CGFloat kFontSize = 20; | 22 const CGFloat kFontSize = 20; |
(...skipping 13 matching lines...) Expand all Loading... |
37 | 36 |
38 @implementation PanelBarView | 37 @implementation PanelBarView |
39 | 38 |
40 - (instancetype)init { | 39 - (instancetype)init { |
41 self = [super initWithFrame:CGRectZero]; | 40 self = [super initWithFrame:CGRectZero]; |
42 if (self) { | 41 if (self) { |
43 [self setBackgroundColor:UIColorFromRGB(kBackgroundColor)]; | 42 [self setBackgroundColor:UIColorFromRGB(kBackgroundColor)]; |
44 // Create and add the bar's title. | 43 // Create and add the bar's title. |
45 UILabel* title = [[UILabel alloc] initWithFrame:CGRectZero]; | 44 UILabel* title = [[UILabel alloc] initWithFrame:CGRectZero]; |
46 [title setTranslatesAutoresizingMaskIntoConstraints:NO]; | 45 [title setTranslatesAutoresizingMaskIntoConstraints:NO]; |
47 [title setFont:[[MDFRobotoFontLoader sharedInstance] | 46 [title setFont:[[MDCTypography fontLoader] mediumFontOfSize:kFontSize]]; |
48 mediumFontOfSize:kFontSize]]; | |
49 [title setTextColor:recent_tabs::GetTextColorGray()]; | 47 [title setTextColor:recent_tabs::GetTextColorGray()]; |
50 [title setTextAlignment:NSTextAlignmentNatural]; | 48 [title setTextAlignment:NSTextAlignmentNatural]; |
51 [title setText:l10n_util::GetNSString(IDS_IOS_NEW_TAB_RECENT_TABS)]; | 49 [title setText:l10n_util::GetNSString(IDS_IOS_NEW_TAB_RECENT_TABS)]; |
52 [title setBackgroundColor:UIColorFromRGB(kBackgroundColor)]; | 50 [title setBackgroundColor:UIColorFromRGB(kBackgroundColor)]; |
53 [self addSubview:title]; | 51 [self addSubview:title]; |
54 | 52 |
55 // Create and add the bar's close button. | 53 // Create and add the bar's close button. |
56 _closeButton = [[UIButton alloc] initWithFrame:CGRectZero]; | 54 _closeButton = [[UIButton alloc] initWithFrame:CGRectZero]; |
57 [_closeButton setTranslatesAutoresizingMaskIntoConstraints:NO]; | 55 [_closeButton setTranslatesAutoresizingMaskIntoConstraints:NO]; |
58 [_closeButton | 56 [_closeButton |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 [self setNeedsUpdateConstraints]; | 121 [self setNeedsUpdateConstraints]; |
124 [super layoutSubviews]; | 122 [super layoutSubviews]; |
125 } | 123 } |
126 | 124 |
127 - (BOOL)coversFullAppWidth { | 125 - (BOOL)coversFullAppWidth { |
128 return self.traitCollection.horizontalSizeClass == | 126 return self.traitCollection.horizontalSizeClass == |
129 self.window.traitCollection.horizontalSizeClass; | 127 self.window.traitCollection.horizontalSizeClass; |
130 } | 128 } |
131 | 129 |
132 @end | 130 @end |
OLD | NEW |