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

Side by Side Diff: ios/chrome/browser/ui/autofill/storage_switch_tooltip.mm

Issue 2912863005: Use MDCTypography instead of MDFRobotoFontLoader directly. (Closed)
Patch Set: Tentative fix for ManualTextFramerTest Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chrome/browser/ui/autofill/storage_switch_tooltip.h" 5 #import "ios/chrome/browser/ui/autofill/storage_switch_tooltip.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/strings/grit/components_strings.h" 8 #include "components/strings/grit/components_strings.h"
9 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" 9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 13 #error "This file requires ARC support."
14 #endif 14 #endif
15 15
16 namespace { 16 namespace {
17 17
18 const CGFloat kCornerRadius = 2.0f; 18 const CGFloat kCornerRadius = 2.0f;
19 const CGFloat kFontSize = 12.0f; 19 const CGFloat kFontSize = 12.0f;
20 const CGFloat kInset = 8.0f; 20 const CGFloat kInset = 8.0f;
21 21
22 } // namespace 22 } // namespace
23 23
24 @implementation StorageSwitchTooltip 24 @implementation StorageSwitchTooltip
25 25
26 - (instancetype)initWithFrame:(CGRect)frame { 26 - (instancetype)initWithFrame:(CGRect)frame {
27 self = [super initWithFrame:frame]; 27 self = [super initWithFrame:frame];
28 if (self) { 28 if (self) {
29 NSString* tooltipText = 29 NSString* tooltipText =
30 l10n_util::GetNSString(IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP); 30 l10n_util::GetNSString(IDS_AUTOFILL_CARD_UNMASK_PROMPT_STORAGE_TOOLTIP);
31 [self setText:tooltipText]; 31 [self setText:tooltipText];
32 [self setTextColor:[UIColor whiteColor]]; 32 [self setTextColor:[UIColor whiteColor]];
33 [self setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.9]]; 33 [self setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.9]];
34 [[self layer] setCornerRadius:kCornerRadius]; 34 [[self layer] setCornerRadius:kCornerRadius];
35 [[self layer] setMasksToBounds:YES]; 35 [[self layer] setMasksToBounds:YES];
36 [self setFont:[[MDFRobotoFontLoader sharedInstance] 36 [self setFont:[[MDCTypography fontLoader] regularFontOfSize:kFontSize]];
37 regularFontOfSize:kFontSize]];
38 [self setNumberOfLines:0]; // Allows multi-line layout. 37 [self setNumberOfLines:0]; // Allows multi-line layout.
39 } 38 }
40 return self; 39 return self;
41 } 40 }
42 41
43 - (instancetype)init { 42 - (instancetype)init {
44 return [self initWithFrame:CGRectZero]; 43 return [self initWithFrame:CGRectZero];
45 } 44 }
46 45
47 - (instancetype)initWithCoder:(NSCoder*)aDecoder { 46 - (instancetype)initWithCoder:(NSCoder*)aDecoder {
(...skipping 17 matching lines...) Expand all
65 64
66 return rect; 65 return rect;
67 } 66 }
68 67
69 - (void)drawTextInRect:(CGRect)rect { 68 - (void)drawTextInRect:(CGRect)rect {
70 UIEdgeInsets insets = {kInset, kInset, kInset, kInset}; 69 UIEdgeInsets insets = {kInset, kInset, kInset, kInset};
71 [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)]; 70 [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)];
72 } 71 }
73 72
74 @end 73 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698