Commit ba948718 authored by Ewann's avatar Ewann Committed by Chromium LUCI CQ

[iOS][PageInfo] Updates navbar title

This CL uses a UILabel to display the site URL instead of an NSString,
to control auto-resizing.

Bug: 1104198
Change-Id: I9c0d508ed209d6bd598584b6ed74a8ecca4b0510
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2603749
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841426}
parent 56a9f973
...@@ -68,9 +68,9 @@ float kPaddingSecurityHeader = 28.0f; ...@@ -68,9 +68,9 @@ float kPaddingSecurityHeader = 28.0f;
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.navigationItem.titleView =
[self titleViewLabelForURL:self.pageInfoSecurityDescription.siteURL];
self.title = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_SITE_INFORMATION); self.title = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_SITE_INFORMATION);
self.navigationItem.prompt = self.pageInfoSecurityDescription.siteURL;
self.navigationController.navigationBar.prefersLargeTitles = NO;
self.tableView.accessibilityIdentifier = kPageInfoViewAccessibilityIdentifier; self.tableView.accessibilityIdentifier = kPageInfoViewAccessibilityIdentifier;
UIBarButtonItem* dismissButton = [[UIBarButtonItem alloc] UIBarButtonItem* dismissButton = [[UIBarButtonItem alloc]
...@@ -147,4 +147,17 @@ float kPaddingSecurityHeader = 28.0f; ...@@ -147,4 +147,17 @@ float kPaddingSecurityHeader = 28.0f;
[self.handler showSecurityHelpPage]; [self.handler showSecurityHelpPage];
} }
#pragma mark - Private
// Returns the navigationItem titleView for |siteURL|.
- (UILabel*)titleViewLabelForURL:(NSString*)siteURL {
UILabel* labelURL = [[UILabel alloc] init];
labelURL.lineBreakMode = NSLineBreakByTruncatingHead;
labelURL.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
labelURL.text = siteURL;
labelURL.adjustsFontSizeToFitWidth = YES;
labelURL.minimumScaleFactor = 0.7;
return labelURL;
}
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment