Commit 347a7fb8 authored by Ewann's avatar Ewann Committed by Commit Bot

[iOS] Preparing Page info site security

This CL Renames page_info_legacy_coordinator. and  page_info_config.
files, preparing for the implementation of the page info site security.

Bug: 1038919
Change-Id: I91a62fd92589f1f6b406b4680c7f7bc1636b24de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089849
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748146}
parent acd34d2a
...@@ -7,12 +7,12 @@ source_set("page_info") { ...@@ -7,12 +7,12 @@ source_set("page_info") {
sources = [ sources = [
"legacy_page_info_view_controller.h", "legacy_page_info_view_controller.h",
"legacy_page_info_view_controller.mm", "legacy_page_info_view_controller.mm",
"page_info_config.h",
"page_info_config.mm",
"page_info_consumer.h", "page_info_consumer.h",
"page_info_description.h", "page_info_description.h",
"page_info_description.mm", "page_info_description.mm",
"page_info_navigation_commands.h", "page_info_navigation_commands.h",
"page_info_site_security_description.h",
"page_info_site_security_description.mm",
"page_info_site_security_view_controller.h", "page_info_site_security_view_controller.h",
"page_info_site_security_view_controller.mm", "page_info_site_security_view_controller.mm",
"page_info_view_controller.h", "page_info_view_controller.h",
...@@ -67,14 +67,14 @@ source_set("features") { ...@@ -67,14 +67,14 @@ source_set("features") {
source_set("coordinator") { source_set("coordinator") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
"legacy_page_info_mediator.h",
"legacy_page_info_mediator.mm",
"page_info_coordinator.h", "page_info_coordinator.h",
"page_info_coordinator.mm", "page_info_coordinator.mm",
"page_info_legacy_coordinator.h", "page_info_legacy_coordinator.h",
"page_info_legacy_coordinator.mm", "page_info_legacy_coordinator.mm",
"page_info_mediator.h", "page_info_mediator.h",
"page_info_mediator.mm", "page_info_mediator.mm",
"page_info_site_security_mediator.h",
"page_info_site_security_mediator.mm",
] ]
deps = [ deps = [
":page_info", ":page_info",
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
@protocol BrowserCommands; @protocol BrowserCommands;
@class PageInfoConfig; @class PageInfoSiteSecurityDescription;
@protocol PageInfoPresentation; @protocol PageInfoPresentation;
// The view controller for the page info view. // The view controller for the page info view.
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
// The |sourcePoint| parameter should be in the coordinate system of // The |sourcePoint| parameter should be in the coordinate system of
// |provider|'s view. Typically, |sourcePoint| would be the midpoint of a button // |provider|'s view. Typically, |sourcePoint| would be the midpoint of a button
// that resulted in this popup being displayed. // that resulted in this popup being displayed.
- (id)initWithModel:(PageInfoConfig*)model - (id)initWithModel:(PageInfoSiteSecurityDescription*)model
sourcePoint:(CGPoint)sourcePoint sourcePoint:(CGPoint)sourcePoint
presentationProvider:(id<PageInfoPresentation>)provider presentationProvider:(id<PageInfoPresentation>)provider
handler:(id<BrowserCommands>)handler; handler:(id<BrowserCommands>)handler;
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h"
#import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h" #import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h"
#include "ios/chrome/browser/ui/page_info/page_info_config.h"
#import "ios/chrome/browser/ui/page_info/page_info_constants.h" #import "ios/chrome/browser/ui/page_info/page_info_constants.h"
#include "ios/chrome/browser/ui/page_info/page_info_site_security_description.h"
#import "ios/chrome/browser/ui/page_info/requirements/page_info_presentation.h" #import "ios/chrome/browser/ui/page_info/requirements/page_info_presentation.h"
#import "ios/chrome/browser/ui/util/animation_util.h" #import "ios/chrome/browser/ui/util/animation_util.h"
#include "ios/chrome/browser/ui/util/rtl_geometry.h" #include "ios/chrome/browser/ui/util/rtl_geometry.h"
...@@ -105,7 +105,7 @@ const CGFloat kButtonXOffset = kTextXPosition; ...@@ -105,7 +105,7 @@ const CGFloat kButtonXOffset = kTextXPosition;
CGPoint _arrowOriginPoint; CGPoint _arrowOriginPoint;
// Model for the data to display. // Model for the data to display.
PageInfoConfig* _model; PageInfoSiteSecurityDescription* _model;
// Width of the view. Depends on the device (iPad/iPhone). // Width of the view. Depends on the device (iPad/iPhone).
CGFloat _viewWidth; CGFloat _viewWidth;
...@@ -129,7 +129,7 @@ const CGFloat kButtonXOffset = kTextXPosition; ...@@ -129,7 +129,7 @@ const CGFloat kButtonXOffset = kTextXPosition;
#pragma mark public #pragma mark public
- (id)initWithModel:(PageInfoConfig*)model - (id)initWithModel:(PageInfoSiteSecurityDescription*)model
sourcePoint:(CGPoint)sourcePoint sourcePoint:(CGPoint)sourcePoint
presentationProvider:(id<PageInfoPresentation>)provider presentationProvider:(id<PageInfoPresentation>)provider
handler:(id<BrowserCommands>)handler { handler:(id<BrowserCommands>)handler {
...@@ -242,7 +242,7 @@ const CGFloat kButtonXOffset = kTextXPosition; ...@@ -242,7 +242,7 @@ const CGFloat kButtonXOffset = kTextXPosition;
offset += imageBaselineDelta; offset += imageBaselineDelta;
// Add the separators. // Add the separators.
if (_model.buttonAction != PageInfoButtonActionNone) { if (_model.buttonAction != PageInfoSiteSecurityButtonActionNone) {
offset += kVerticalSpacing; offset += kVerticalSpacing;
} }
...@@ -482,24 +482,24 @@ const CGFloat kButtonXOffset = kTextXPosition; ...@@ -482,24 +482,24 @@ const CGFloat kButtonXOffset = kTextXPosition;
// Returns a button with title and action configured for |buttonAction|. // Returns a button with title and action configured for |buttonAction|.
- (UIButton*)buttonForAction:(PageInfoButtonAction)buttonAction { - (UIButton*)buttonForAction:(PageInfoButtonAction)buttonAction {
if (buttonAction == PageInfoButtonActionNone) { if (buttonAction == PageInfoSiteSecurityButtonActionNone) {
return nil; return nil;
} }
UIButton* button = [[UIButton alloc] initWithFrame:CGRectZero]; UIButton* button = [[UIButton alloc] initWithFrame:CGRectZero];
int messageId; int messageId;
NSString* accessibilityID = @"Reload button"; NSString* accessibilityID = @"Reload button";
switch (buttonAction) { switch (buttonAction) {
case PageInfoButtonActionNone: case PageInfoSiteSecurityButtonActionNone:
NOTREACHED(); NOTREACHED();
return nil; return nil;
case PageInfoButtonActionShowHelp: case PageInfoSiteSecurityButtonActionShowHelp:
messageId = IDS_LEARN_MORE; messageId = IDS_LEARN_MORE;
accessibilityID = @"Learn more"; accessibilityID = @"Learn more";
[button addTarget:self.handler [button addTarget:self.handler
action:@selector(showSecurityHelpPage) action:@selector(showSecurityHelpPage)
forControlEvents:UIControlEventTouchUpInside]; forControlEvents:UIControlEventTouchUpInside];
break; break;
case PageInfoButtonActionReload: case PageInfoSiteSecurityButtonActionReload:
messageId = IDS_IOS_PAGE_INFO_RELOAD; messageId = IDS_IOS_PAGE_INFO_RELOAD;
accessibilityID = @"Reload button"; accessibilityID = @"Reload button";
[button addTarget:self.handler [button addTarget:self.handler
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
#import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/fullscreen/chrome_coordinator+fullscreen_disabling.h" #import "ios/chrome/browser/ui/fullscreen/chrome_coordinator+fullscreen_disabling.h"
#import "ios/chrome/browser/ui/page_info/legacy_page_info_mediator.h"
#import "ios/chrome/browser/ui/page_info/legacy_page_info_view_controller.h" #import "ios/chrome/browser/ui/page_info/legacy_page_info_view_controller.h"
#import "ios/chrome/browser/ui/page_info/page_info_constants.h" #import "ios/chrome/browser/ui/page_info/page_info_constants.h"
#import "ios/chrome/browser/ui/page_info/page_info_site_security_mediator.h"
#import "ios/chrome/browser/ui/page_info/requirements/page_info_presentation.h" #import "ios/chrome/browser/ui/page_info/requirements/page_info_presentation.h"
#import "ios/chrome/browser/url_loading/url_loading_params.h" #import "ios/chrome/browser/url_loading/url_loading_params.h"
#import "ios/chrome/browser/url_loading/url_loading_service.h" #import "ios/chrome/browser/url_loading/url_loading_service.h"
...@@ -83,10 +83,10 @@ ...@@ -83,10 +83,10 @@
bool presentingOfflinePage = bool presentingOfflinePage =
OfflinePageTabHelper::FromWebState(webState)->presenting_offline_page(); OfflinePageTabHelper::FromWebState(webState)->presenting_offline_page();
PageInfoConfig* config = PageInfoSiteSecurityDescription* config =
[LegacyPageInfoMediator configurationForURL:navItem->GetURL() [PageInfoSiteSecurityMediator configurationForURL:navItem->GetURL()
SSLStatus:navItem->GetSSL() SSLStatus:navItem->GetSSL()
offlinePage:presentingOfflinePage]; offlinePage:presentingOfflinePage];
CGPoint originPresentationCoordinates = [self.presentationProvider CGPoint originPresentationCoordinates = [self.presentationProvider
convertToPresentationCoordinatesForOrigin:self.originPoint]; convertToPresentationCoordinatesForOrigin:self.originPoint];
......
...@@ -2,23 +2,23 @@ ...@@ -2,23 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_CONFIG_H_ #ifndef IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_SITE_SECURITY_DESCRIPTION_H_
#define IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_CONFIG_H_ #define IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_SITE_SECURITY_DESCRIPTION_H_
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
// Types of the different actions the page info button can have. // Types of the different actions the page info site security button can have.
typedef NS_ENUM(NSUInteger, PageInfoButtonAction) { typedef NS_ENUM(NSUInteger, PageInfoButtonAction) {
// No action. // No action.
PageInfoButtonActionNone, PageInfoSiteSecurityButtonActionNone,
// Show the help page. // Show the help page.
PageInfoButtonActionShowHelp, PageInfoSiteSecurityButtonActionShowHelp,
// Reload the page. // Reload the page.
PageInfoButtonActionReload, PageInfoSiteSecurityButtonActionReload,
}; };
// Config for the information displayed by the PageInfo. // Config for the information displayed by the page info site security.
@interface PageInfoConfig : NSObject @interface PageInfoSiteSecurityDescription : NSObject
@property(nonatomic, copy) NSString* title; @property(nonatomic, copy) NSString* title;
@property(nonatomic, copy) NSString* message; @property(nonatomic, copy) NSString* message;
...@@ -27,4 +27,4 @@ typedef NS_ENUM(NSUInteger, PageInfoButtonAction) { ...@@ -27,4 +27,4 @@ typedef NS_ENUM(NSUInteger, PageInfoButtonAction) {
@end @end
#endif // IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_CONFIG_H_ #endif // IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_SITE_SECURITY_DESCRIPTION_H_
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#import "ios/chrome/browser/ui/page_info/page_info_config.h" #import "ios/chrome/browser/ui/page_info/page_info_site_security_description.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
@implementation PageInfoConfig @implementation PageInfoSiteSecurityDescription
@end @end
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_PAGE_INFO_LEGACY_PAGE_INFO_MEDIATOR_H_ #ifndef IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_SITE_SECURITY_MEDIATOR_H_
#define IOS_CHROME_BROWSER_UI_PAGE_INFO_LEGACY_PAGE_INFO_MEDIATOR_H_ #define IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_SITE_SECURITY_MEDIATOR_H_
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
...@@ -11,22 +11,22 @@ namespace web { ...@@ -11,22 +11,22 @@ namespace web {
struct SSLStatus; struct SSLStatus;
} }
@class PageInfoConfig; @class PageInfoSiteSecurityDescription;
class GURL; class GURL;
// Mediator for the PageInfo, extracting the data to be displayed for the web // Mediator for the page info site security, extracting the data to be displayed
// informations. // for the view controller.
@interface LegacyPageInfoMediator : NSObject @interface PageInfoSiteSecurityMediator : NSObject
// For now this object only have static method. // For now this object only have static method.
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
// Returns a configuration based on the |URL|, the SSL |status| and if the // Returns a configuration based on the |URL|, the SSL |status| and if the
// current page is an |offlinePage|. // current page is an |offlinePage|.
+ (PageInfoConfig*)configurationForURL:(const GURL&)URL + (PageInfoSiteSecurityDescription*)configurationForURL:(const GURL&)URL
SSLStatus:(web::SSLStatus&)status SSLStatus:(web::SSLStatus&)status
offlinePage:(BOOL)offlinePage; offlinePage:(BOOL)offlinePage;
@end @end
#endif // IOS_CHROME_BROWSER_UI_PAGE_INFO_LEGACY_PAGE_INFO_MEDIATOR_H_ #endif // IOS_CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_SITE_SECURITY_MEDIATOR_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#import "ios/chrome/browser/ui/page_info/legacy_page_info_mediator.h" #import "ios/chrome/browser/ui/page_info/page_info_site_security_mediator.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "components/strings/grit/components_google_chrome_strings.h" #include "components/strings/grit/components_google_chrome_strings.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/chrome_url_constants.h"
#import "ios/chrome/browser/ui/page_info/page_info_config.h" #import "ios/chrome/browser/ui/page_info/page_info_site_security_description.h"
#include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#include "ios/web/public/security/ssl_status.h" #include "ios/web/public/security/ssl_status.h"
...@@ -61,17 +61,18 @@ NSString* BuildMessage(NSArray<NSString*>* messageComponents) { ...@@ -61,17 +61,18 @@ NSString* BuildMessage(NSArray<NSString*>* messageComponents) {
} // namespace } // namespace
@implementation LegacyPageInfoMediator @implementation PageInfoSiteSecurityMediator
+ (PageInfoConfig*)configurationForURL:(const GURL&)URL + (PageInfoSiteSecurityDescription*)configurationForURL:(const GURL&)URL
SSLStatus:(web::SSLStatus&)status SSLStatus:(web::SSLStatus&)status
offlinePage:(BOOL)offlinePage { offlinePage:(BOOL)offlinePage {
PageInfoConfig* dataHolder = [[PageInfoConfig alloc] init]; PageInfoSiteSecurityDescription* dataHolder =
[[PageInfoSiteSecurityDescription alloc] init];
if (offlinePage) { if (offlinePage) {
dataHolder.title = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_OFFLINE_TITLE); dataHolder.title = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_OFFLINE_TITLE);
dataHolder.message = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_OFFLINE_PAGE); dataHolder.message = l10n_util::GetNSString(IDS_IOS_PAGE_INFO_OFFLINE_PAGE);
dataHolder.image = [UIImage imageNamed:@"page_info_offline"]; dataHolder.image = [UIImage imageNamed:@"page_info_offline"];
dataHolder.buttonAction = PageInfoButtonActionReload; dataHolder.buttonAction = PageInfoSiteSecurityButtonActionReload;
return dataHolder; return dataHolder;
} }
...@@ -79,13 +80,13 @@ NSString* BuildMessage(NSArray<NSString*>* messageComponents) { ...@@ -79,13 +80,13 @@ NSString* BuildMessage(NSArray<NSString*>* messageComponents) {
dataHolder.title = base::SysUTF8ToNSString(URL.spec()); dataHolder.title = base::SysUTF8ToNSString(URL.spec());
dataHolder.message = l10n_util::GetNSString(IDS_PAGE_INFO_INTERNAL_PAGE); dataHolder.message = l10n_util::GetNSString(IDS_PAGE_INFO_INTERNAL_PAGE);
dataHolder.image = nil; dataHolder.image = nil;
dataHolder.buttonAction = PageInfoButtonActionNone; dataHolder.buttonAction = PageInfoSiteSecurityButtonActionNone;
return dataHolder; return dataHolder;
} }
// At this point, this is a web page. // At this point, this is a web page.
dataHolder.title = base::SysUTF8ToNSString(URL.host()); dataHolder.title = base::SysUTF8ToNSString(URL.host());
dataHolder.buttonAction = PageInfoButtonActionShowHelp; dataHolder.buttonAction = PageInfoSiteSecurityButtonActionShowHelp;
// Summary and details. // Summary and details.
if (!status.certificate) { if (!status.certificate) {
......
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