Commit 4cba05d3 authored by Ewann's avatar Ewann Committed by Commit Bot

Update the view controller of the page info

The root of the info page consists of a table view, we added a
"Site security" item to it.
This item indicates whether the site is secure or not and depending
on this displays an icon.

Bug: 1038919
Change-Id: I29cd0e3b535e44b65837210ce67f40248750da9d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087818
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747657}
parent 89af4c23
...@@ -1168,6 +1168,12 @@ Handoff must also be enabled in the General section of Settings, and your device ...@@ -1168,6 +1168,12 @@ Handoff must also be enabled in the General section of Settings, and your device
<message name="IDS_IOS_PAGE_INFO_SECURITY_BUTTON_ACCESSIBILITY_LABEL" desc="The accessibility text for the page security info button"> <message name="IDS_IOS_PAGE_INFO_SECURITY_BUTTON_ACCESSIBILITY_LABEL" desc="The accessibility text for the page security info button">
Page Security Info Page Security Info
</message> </message>
<message name="IDS_IOS_PAGE_INFO_SITE_INFORMATION" desc="Title of the navigation controller to display when the page info is presented.">
Site information
</message>
<message name="IDS_IOS_PAGE_INFO_SITE_SECURITY" desc="Title of the button opening the site security information (in page info)">
Site security
</message>
<message name="IDS_IOS_PAGE_LOADED_ACCESSIBILITY_ANNOUNCEMENT" desc="The accessibility announcement when a page has loaded. [Length: unlimited] [iOS only]"> <message name="IDS_IOS_PAGE_LOADED_ACCESSIBILITY_ANNOUNCEMENT" desc="The accessibility announcement when a page has loaded. [Length: unlimited] [iOS only]">
Webpage loaded Webpage loaded
</message> </message>
......
...@@ -30,6 +30,7 @@ source_set("page_info") { ...@@ -30,6 +30,7 @@ source_set("page_info") {
"//ios/chrome/browser/ui/fancy_ui", "//ios/chrome/browser/ui/fancy_ui",
"//ios/chrome/browser/ui/page_info/requirements", "//ios/chrome/browser/ui/page_info/requirements",
"//ios/chrome/browser/ui/popup_menu", "//ios/chrome/browser/ui/popup_menu",
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/browser/ui/util", "//ios/chrome/browser/ui/util",
"//ios/chrome/common", "//ios/chrome/common",
"//ios/chrome/common/ui/colors", "//ios/chrome/common/ui/colors",
......
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
#pragma mark - ChromeCoordinator #pragma mark - ChromeCoordinator
- (void)start { - (void)start {
self.viewController = [[PageInfoViewController alloc] init]; self.viewController =
[[PageInfoViewController alloc] initWithStyle:UITableViewStylePlain];
web::WebState* webState = web::WebState* webState =
self.browser->GetWebStateList()->GetActiveWebState(); self.browser->GetWebStateList()->GetActiveWebState();
self.mediator = [[PageInfoMediator alloc] initWithWebState:webState]; self.mediator = [[PageInfoMediator alloc] initWithWebState:webState];
......
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/page_info/page_info_consumer.h" #import "ios/chrome/browser/ui/page_info/page_info_consumer.h"
#import "ios/chrome/browser/ui/table_view/chrome_table_view_controller.h"
// View Controller for displaying the page info. // View Controller for displaying the page info.
@interface PageInfoViewController : UIViewController <PageInfoConsumer> @interface PageInfoViewController : ChromeTableViewController <PageInfoConsumer>
@end @end
......
...@@ -4,18 +4,55 @@ ...@@ -4,18 +4,55 @@
#import "ios/chrome/browser/ui/page_info/page_info_view_controller.h" #import "ios/chrome/browser/ui/page_info/page_info_view_controller.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_detail_icon_item.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
namespace {
typedef NS_ENUM(NSInteger, SectionIdentifier) {
SectionIdentifierContent = kSectionIdentifierEnumZero,
};
typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeSecurity = kItemTypeEnumZero,
};
} // namespace
@implementation PageInfoViewController @implementation PageInfoViewController
#pragma mark - UIViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_SITE_INFORMATION);
}
#pragma mark - PageInfoConsumer #pragma mark - PageInfoConsumer
- (void)pageInfoChanged:(PageInfoDescription*)pageInfoDescription { - (void)pageInfoChanged:(PageInfoDescription*)pageInfoDescription {
// Show new page info in the UI. [self loadModel];
// TODO(crbug.com/1038919): Implement this.
self.view.backgroundColor = [UIColor redColor]; [self.tableViewModel addSectionWithIdentifier:SectionIdentifierContent];
// Create the Security item.
TableViewDetailIconItem* securityItem =
[[TableViewDetailIconItem alloc] initWithType:ItemTypeSecurity];
securityItem.text = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_SITE_SECURITY);
securityItem.detailText = pageInfoDescription.pageSecurityStatusDescription;
securityItem.iconImageName =
pageInfoDescription.pageSecurityStatusIconImageName;
securityItem.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[self.tableViewModel addItem:securityItem
toSectionWithIdentifier:SectionIdentifierContent];
[self.tableView reloadData];
} }
@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