Commit c4688765 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Add AlertCoordinator initializer that takes a BrowserState.

This will allow AlertCoordinators to access FullscreenController, which
will provide the necessary insets to use for non-modal alert
presentation.

This CL also removes the unnecessary empty initializers, as this is
handled by the NS_UNAVAILABLE annotation now.

Bug: 674649
Change-Id: I0d1b5efbcf0266103090e879b078cef64df42593
Reviewed-on: https://chromium-review.googlesource.com/c/1340602
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613327}
parent 95b5ffeb
......@@ -28,6 +28,12 @@
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
title:(NSString*)title
message:(NSString*)message NS_UNAVAILABLE;
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
title:(NSString*)title
message:(NSString*)message
browserState:
(ios::ChromeBrowserState*)browserState
NS_UNAVAILABLE;
// Configures the underlying UIAlertController's popover arrow direction.
// Default is UIPopoverArrowDirectionAny.
......
......@@ -38,13 +38,6 @@ enum class AnchorMode {
@implementation ActionSheetCoordinator
@synthesize popoverArrowDirection = _popoverArrowDirection;
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
title:(NSString*)title
message:(NSString*)message {
NOTREACHED();
return nil;
}
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
title:(NSString*)title
message:(NSString*)message
......
......@@ -38,6 +38,12 @@
title:(NSString*)title
message:(NSString*)message
NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
title:(NSString*)title
message:(NSString*)message
browserState:
(ios::ChromeBrowserState*)browserState
NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
NS_UNAVAILABLE;
......
......@@ -44,22 +44,34 @@
@synthesize rawCancelAction = _rawCancelAction;
@synthesize message = _message;
- (instancetype)initWithBaseViewController:(UIViewController*)viewController {
NOTREACHED();
return nil;
}
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
title:(NSString*)title
message:(NSString*)message {
self = [super initWithBaseViewController:viewController browserState:nullptr];
if (self) {
_title = [title copy];
_message = [message copy];
[self commonInitWithTitle:title message:message];
}
return self;
}
- (instancetype)initWithBaseViewController:(UIViewController*)viewController
title:(NSString*)title
message:(NSString*)message
browserState:
(ios::ChromeBrowserState*)browserState {
self = [super initWithBaseViewController:viewController
browserState:browserState];
if (self) {
[self commonInitWithTitle:title message:message];
}
return self;
}
- (void)commonInitWithTitle:(NSString*)title message:(NSString*)message {
_title = title;
_message = message;
}
#pragma mark - Public Methods.
- (void)addItemWithTitle:(NSString*)title
......
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