Commit da74dc03 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][Password-Breach] Open checkup URL

Opens the checkup url as the primary action. This is done via a New
Tab Command.

Bug: 1008862
Change-Id: I7bd8090050daadc0a0c9bd10aeffe63c63875cb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845003Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704138}
parent cbaec130
......@@ -62,9 +62,12 @@
- (void)showPasswordBreachForLeakType:(CredentialLeakType)leakType
URL:(const GURL&)URL {
self.viewController = [[PasswordBreachViewController alloc] init];
id<ApplicationCommands> dispatcher =
static_cast<id<ApplicationCommands>>(self.dispatcher);
self.mediator =
[[PasswordBreachMediator alloc] initWithConsumer:self.viewController
presenter:self
dispatcher:dispatcher
URL:URL
leakType:leakType];
self.viewController.actionHandler = self.mediator;
......
......@@ -12,6 +12,7 @@
class GURL;
@protocol ApplicationCommands;
@protocol PasswordBreachConsumer;
// Object presenting the feature.
......@@ -27,6 +28,7 @@ class GURL;
- (instancetype)initWithConsumer:(id<PasswordBreachConsumer>)consumer
presenter:(id<PasswordBreachPresenter>)presenter
dispatcher:(id<ApplicationCommands>)dispatcher
URL:(const GURL&)URL
leakType:(password_manager::CredentialLeakType)leakType;
......
......@@ -6,6 +6,8 @@
#include "base/strings/sys_string_conversions.h"
#include "components/password_manager/core/browser/leak_detection_dialog_utils.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/passwords/password_breach_consumer.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -19,23 +21,29 @@ using password_manager::GetCancelButtonLabel;
using password_manager::GetDescription;
using password_manager::GetTitle;
using password_manager::ShouldCheckPasswords;
using password_manager::GetPasswordCheckupURL;
@interface PasswordBreachMediator ()
// The presenter of the feature.
@property(nonatomic, weak) id<PasswordBreachPresenter> presenter;
// Dispatcher.
@property(nonatomic, weak) id<ApplicationCommands> dispatcher;
@end
@implementation PasswordBreachMediator
- (instancetype)initWithConsumer:(id<PasswordBreachConsumer>)consumer
presenter:(id<PasswordBreachPresenter>)presenter
dispatcher:(id<ApplicationCommands>)dispatcher
URL:(const GURL&)URL
leakType:(CredentialLeakType)leakType {
self = [super init];
if (self) {
_presenter = presenter;
_dispatcher = dispatcher;
NSString* subtitle = SysUTF16ToNSString(GetDescription(leakType, URL));
NSString* primaryActionString =
SysUTF16ToNSString(GetAcceptButtonLabel(leakType));
......@@ -54,7 +62,9 @@ using password_manager::ShouldCheckPasswords;
}
- (void)passwordBreachPrimaryAction {
// TODO(crbug.com/1008862): Open the passwords checkup URL.
OpenNewTabCommand* newTabCommand =
[OpenNewTabCommand commandWithURLFromChrome:GetPasswordCheckupURL()];
[self.dispatcher openURLInNewTab:newTabCommand];
}
@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