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

Side by Side Diff: ios/chrome/browser/ui/sad_tab/sad_tab_view.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/sad_tab/sad_tab_view.h" 5 #import "ios/chrome/browser/ui/sad_tab/sad_tab_view.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "components/grit/components_scaled_resources.h" 8 #include "components/grit/components_scaled_resources.h"
9 #include "components/strings/grit/components_strings.h" 9 #include "components/strings/grit/components_strings.h"
10 #include "ios/chrome/browser/chrome_url_constants.h" 10 #include "ios/chrome/browser/chrome_url_constants.h"
11 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" 11 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
12 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" 12 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
13 #import "ios/chrome/browser/ui/commands/ios_command_ids.h" 13 #import "ios/chrome/browser/ui/commands/ios_command_ids.h"
14 #import "ios/chrome/browser/ui/commands/open_url_command.h" 14 #import "ios/chrome/browser/ui/commands/open_url_command.h"
15 #include "ios/chrome/browser/ui/rtl_geometry.h" 15 #include "ios/chrome/browser/ui/rtl_geometry.h"
16 #import "ios/chrome/browser/ui/uikit_ui_util.h" 16 #import "ios/chrome/browser/ui/uikit_ui_util.h"
17 #import "ios/chrome/browser/ui/url_loader.h" 17 #import "ios/chrome/browser/ui/url_loader.h"
18 #import "ios/chrome/browser/ui/util/label_link_controller.h" 18 #import "ios/chrome/browser/ui/util/label_link_controller.h"
19 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate rialButtons.h" 19 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate rialButtons.h"
20 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" 20 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
21 #include "ios/web/public/navigation_manager.h" 21 #include "ios/web/public/navigation_manager.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 #if !defined(__has_feature) || !__has_feature(objc_arc) 25 #if !defined(__has_feature) || !__has_feature(objc_arc)
26 #error "This file requires ARC support." 26 #error "This file requires ARC support."
27 #endif 27 #endif
28 28
29 namespace { 29 namespace {
30 // Color constants. 30 // Color constants.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 __weak __typeof(self) weakSelf = self; 306 __weak __typeof(self) weakSelf = self;
307 _footerLabelLinkController = [[LabelLinkController alloc] 307 _footerLabelLinkController = [[LabelLinkController alloc]
308 initWithLabel:label 308 initWithLabel:label
309 action:^(const GURL& URL) { 309 action:^(const GURL& URL) {
310 OpenUrlCommand* command = 310 OpenUrlCommand* command =
311 [[OpenUrlCommand alloc] initWithURLFromChrome:URL]; 311 [[OpenUrlCommand alloc] initWithURLFromChrome:URL];
312 [weakSelf chromeExecuteCommand:command]; 312 [weakSelf chromeExecuteCommand:command];
313 }]; 313 }];
314 314
315 _footerLabelLinkController.linkFont = 315 _footerLabelLinkController.linkFont =
316 [MDFRobotoFontLoader.sharedInstance boldFontOfSize:kFooterLabelFontSize]; 316 [[MDCTypography fontLoader] boldFontOfSize:kFooterLabelFontSize];
317 _footerLabelLinkController.linkUnderlineStyle = NSUnderlineStyleSingle; 317 _footerLabelLinkController.linkUnderlineStyle = NSUnderlineStyleSingle;
318 NSRange linkRange = [label.text rangeOfString:linkText]; 318 NSRange linkRange = [label.text rangeOfString:linkText];
319 DCHECK(linkRange.location != NSNotFound); 319 DCHECK(linkRange.location != NSNotFound);
320 DCHECK(linkRange.length > 0); 320 DCHECK(linkRange.length > 0);
321 [_footerLabelLinkController addLinkWithRange:linkRange 321 [_footerLabelLinkController addLinkWithRange:linkRange
322 url:GURL(kCrashReasonURL)]; 322 url:GURL(kCrashReasonURL)];
323 } 323 }
324 324
325 #pragma mark Accessors 325 #pragma mark Accessors
326 326
(...skipping 17 matching lines...) Expand all
344 - (UILabel*)titleLabel { 344 - (UILabel*)titleLabel {
345 if (!_titleLabel) { 345 if (!_titleLabel) {
346 _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 346 _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
347 [_titleLabel setBackgroundColor:self.backgroundColor]; 347 [_titleLabel setBackgroundColor:self.backgroundColor];
348 [_titleLabel setText:[self titleLabelText]]; 348 [_titleLabel setText:[self titleLabelText]];
349 [_titleLabel setLineBreakMode:NSLineBreakByWordWrapping]; 349 [_titleLabel setLineBreakMode:NSLineBreakByWordWrapping];
350 [_titleLabel setNumberOfLines:0]; 350 [_titleLabel setNumberOfLines:0];
351 [_titleLabel 351 [_titleLabel
352 setTextColor:[UIColor colorWithWhite:kTitleLabelTextColorBrightness 352 setTextColor:[UIColor colorWithWhite:kTitleLabelTextColorBrightness
353 alpha:1.0]]; 353 alpha:1.0]];
354 [_titleLabel setFont:[[MDFRobotoFontLoader sharedInstance] 354 [_titleLabel setFont:[[MDCTypography fontLoader]
355 regularFontOfSize:kTitleLabelFontSize]]; 355 regularFontOfSize:kTitleLabelFontSize]];
356 } 356 }
357 return _titleLabel; 357 return _titleLabel;
358 } 358 }
359 359
360 - (UITextView*)messageTextView { 360 - (UITextView*)messageTextView {
361 if (!_messageTextView) { 361 if (!_messageTextView) {
362 _messageTextView = [[UITextView alloc] initWithFrame:CGRectZero]; 362 _messageTextView = [[UITextView alloc] initWithFrame:CGRectZero];
363 [_messageTextView setBackgroundColor:self.backgroundColor]; 363 [_messageTextView setBackgroundColor:self.backgroundColor];
364 [_messageTextView setAttributedText:[self messageTextViewAttributedText]]; 364 [_messageTextView setAttributedText:[self messageTextViewAttributedText]];
365 _messageTextView.textContainer.lineFragmentPadding = 0.0f; 365 _messageTextView.textContainer.lineFragmentPadding = 0.0f;
366 [_messageTextView 366 [_messageTextView
367 setTextColor:[UIColor colorWithWhite:kGeneralTextColorBrightness 367 setTextColor:[UIColor colorWithWhite:kGeneralTextColorBrightness
368 alpha:1.0]]; 368 alpha:1.0]];
369 [_messageTextView setFont:[[MDFRobotoFontLoader sharedInstance] 369 [_messageTextView setFont:[[MDCTypography fontLoader]
370 regularFontOfSize:kMessageTextViewFontSize]]; 370 regularFontOfSize:kMessageTextViewFontSize]];
371 } 371 }
372 return _messageTextView; 372 return _messageTextView;
373 } 373 }
374 374
375 - (UILabel*)footerLabel { 375 - (UILabel*)footerLabel {
376 if (!_footerLabel) { 376 if (!_footerLabel) {
377 _footerLabel = [[UILabel alloc] initWithFrame:CGRectZero]; 377 _footerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
378 [_footerLabel setBackgroundColor:self.backgroundColor]; 378 [_footerLabel setBackgroundColor:self.backgroundColor];
379 [_footerLabel setNumberOfLines:0]; 379 [_footerLabel setNumberOfLines:0];
380 [_footerLabel setFont:[[MDFRobotoFontLoader sharedInstance] 380 [_footerLabel setFont:[[MDCTypography fontLoader]
381 regularFontOfSize:kFooterLabelFontSize]]; 381 regularFontOfSize:kFooterLabelFontSize]];
382 [_footerLabel 382 [_footerLabel
383 setTextColor:[UIColor colorWithWhite:kGeneralTextColorBrightness 383 setTextColor:[UIColor colorWithWhite:kGeneralTextColorBrightness
384 alpha:1.0]]; 384 alpha:1.0]];
385 385
386 [_footerLabel setText:[self footerLabelText]]; 386 [_footerLabel setText:[self footerLabelText]];
387 [self attachLinkControllerToLabel:_footerLabel 387 [self attachLinkControllerToLabel:_footerLabel
388 forLinkText:[self footerLinkText]]; 388 forLinkText:[self footerLinkText]];
389 } 389 }
390 return _footerLabel; 390 return _footerLabel;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 break; 565 break;
566 } 566 }
567 }; 567 };
568 } 568 }
569 569
570 + (UIColor*)sadTabBackgroundColor { 570 + (UIColor*)sadTabBackgroundColor {
571 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; 571 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0];
572 } 572 }
573 573
574 @end 574 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698