| OLD | NEW |
| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 __weak __typeof(self) weakSelf = self; | 272 __weak __typeof(self) weakSelf = self; |
| 273 _footerLabelLinkController = [[LabelLinkController alloc] | 273 _footerLabelLinkController = [[LabelLinkController alloc] |
| 274 initWithLabel:label | 274 initWithLabel:label |
| 275 action:^(const GURL& URL) { | 275 action:^(const GURL& URL) { |
| 276 OpenUrlCommand* command = | 276 OpenUrlCommand* command = |
| 277 [[OpenUrlCommand alloc] initWithURLFromChrome:URL]; | 277 [[OpenUrlCommand alloc] initWithURLFromChrome:URL]; |
| 278 [weakSelf chromeExecuteCommand:command]; | 278 [weakSelf chromeExecuteCommand:command]; |
| 279 }]; | 279 }]; |
| 280 | 280 |
| 281 _footerLabelLinkController.linkFont = | 281 _footerLabelLinkController.linkFont = |
| 282 [MDFRobotoFontLoader.sharedInstance boldFontOfSize:kFooterLabelFontSize]; | 282 [[MDCTypography fontLoader] boldFontOfSize:kFooterLabelFontSize]; |
| 283 _footerLabelLinkController.linkUnderlineStyle = NSUnderlineStyleSingle; | 283 _footerLabelLinkController.linkUnderlineStyle = NSUnderlineStyleSingle; |
| 284 NSRange linkRange = [label.text rangeOfString:linkText]; | 284 NSRange linkRange = [label.text rangeOfString:linkText]; |
| 285 DCHECK(linkRange.location != NSNotFound); | 285 DCHECK(linkRange.location != NSNotFound); |
| 286 DCHECK(linkRange.length > 0); | 286 DCHECK(linkRange.length > 0); |
| 287 [_footerLabelLinkController addLinkWithRange:linkRange | 287 [_footerLabelLinkController addLinkWithRange:linkRange |
| 288 url:GURL(kCrashReasonURL)]; | 288 url:GURL(kCrashReasonURL)]; |
| 289 } | 289 } |
| 290 | 290 |
| 291 #pragma mark Accessors | 291 #pragma mark Accessors |
| 292 | 292 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 310 - (UILabel*)titleLabel { | 310 - (UILabel*)titleLabel { |
| 311 if (!_titleLabel) { | 311 if (!_titleLabel) { |
| 312 _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 312 _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 313 [_titleLabel setBackgroundColor:self.backgroundColor]; | 313 [_titleLabel setBackgroundColor:self.backgroundColor]; |
| 314 [_titleLabel setText:[self titleLabelText]]; | 314 [_titleLabel setText:[self titleLabelText]]; |
| 315 [_titleLabel setLineBreakMode:NSLineBreakByWordWrapping]; | 315 [_titleLabel setLineBreakMode:NSLineBreakByWordWrapping]; |
| 316 [_titleLabel setNumberOfLines:0]; | 316 [_titleLabel setNumberOfLines:0]; |
| 317 [_titleLabel | 317 [_titleLabel |
| 318 setTextColor:[UIColor colorWithWhite:kTitleLabelTextColorBrightness | 318 setTextColor:[UIColor colorWithWhite:kTitleLabelTextColorBrightness |
| 319 alpha:1.0]]; | 319 alpha:1.0]]; |
| 320 [_titleLabel setFont:[[MDFRobotoFontLoader sharedInstance] | 320 [_titleLabel setFont:[[MDCTypography fontLoader] |
| 321 regularFontOfSize:kTitleLabelFontSize]]; | 321 regularFontOfSize:kTitleLabelFontSize]]; |
| 322 } | 322 } |
| 323 return _titleLabel; | 323 return _titleLabel; |
| 324 } | 324 } |
| 325 | 325 |
| 326 - (UILabel*)messageLabel { | 326 - (UILabel*)messageLabel { |
| 327 if (!_messageLabel) { | 327 if (!_messageLabel) { |
| 328 _messageLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 328 _messageLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 329 [_messageLabel setBackgroundColor:self.backgroundColor]; | 329 [_messageLabel setBackgroundColor:self.backgroundColor]; |
| 330 [_messageLabel setText:[self messageLabelText]]; | 330 [_messageLabel setText:[self messageLabelText]]; |
| 331 [_messageLabel setLineBreakMode:NSLineBreakByWordWrapping]; | 331 [_messageLabel setLineBreakMode:NSLineBreakByWordWrapping]; |
| 332 [_messageLabel setNumberOfLines:0]; | 332 [_messageLabel setNumberOfLines:0]; |
| 333 [_messageLabel | 333 [_messageLabel |
| 334 setTextColor:[UIColor colorWithWhite:kMessageLabelTextColorBrightness | 334 setTextColor:[UIColor colorWithWhite:kMessageLabelTextColorBrightness |
| 335 alpha:1.0]]; | 335 alpha:1.0]]; |
| 336 [_messageLabel setFont:[[MDFRobotoFontLoader sharedInstance] | 336 [_messageLabel setFont:[[MDCTypography fontLoader] |
| 337 regularFontOfSize:kMessageLabelFontSize]]; | 337 regularFontOfSize:kMessageLabelFontSize]]; |
| 338 } | 338 } |
| 339 return _messageLabel; | 339 return _messageLabel; |
| 340 } | 340 } |
| 341 | 341 |
| 342 - (UILabel*)footerLabel { | 342 - (UILabel*)footerLabel { |
| 343 if (!_footerLabel) { | 343 if (!_footerLabel) { |
| 344 _footerLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 344 _footerLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
| 345 [_footerLabel setBackgroundColor:self.backgroundColor]; | 345 [_footerLabel setBackgroundColor:self.backgroundColor]; |
| 346 [_footerLabel setNumberOfLines:0]; | 346 [_footerLabel setNumberOfLines:0]; |
| 347 [_footerLabel setFont:[[MDFRobotoFontLoader sharedInstance] | 347 [_footerLabel setFont:[[MDCTypography fontLoader] |
| 348 regularFontOfSize:kFooterLabelFontSize]]; | 348 regularFontOfSize:kFooterLabelFontSize]]; |
| 349 [_footerLabel | 349 [_footerLabel |
| 350 setTextColor:[UIColor colorWithWhite:kMessageLabelTextColorBrightness | 350 setTextColor:[UIColor colorWithWhite:kMessageLabelTextColorBrightness |
| 351 alpha:1.0]]; | 351 alpha:1.0]]; |
| 352 | 352 |
| 353 [_footerLabel setText:[self footerLabelText]]; | 353 [_footerLabel setText:[self footerLabelText]]; |
| 354 [self attachLinkControllerToLabel:_footerLabel | 354 [self attachLinkControllerToLabel:_footerLabel |
| 355 forLinkText:[self footerLinkText]]; | 355 forLinkText:[self footerLinkText]]; |
| 356 } | 356 } |
| 357 return _footerLabel; | 357 return _footerLabel; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 break; | 532 break; |
| 533 } | 533 } |
| 534 }; | 534 }; |
| 535 } | 535 } |
| 536 | 536 |
| 537 + (UIColor*)sadTabBackgroundColor { | 537 + (UIColor*)sadTabBackgroundColor { |
| 538 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; | 538 return [UIColor colorWithWhite:kBackgroundColorBrightness alpha:1.0]; |
| 539 } | 539 } |
| 540 | 540 |
| 541 @end | 541 @end |
| OLD | NEW |