Chromium Code Reviews| Index: ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.mm |
| diff --git a/ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.mm b/ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4484ed9b1f2a7f07f498085437415ead8f4c2d06 |
| --- /dev/null |
| +++ b/ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.mm |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h" |
| + |
| +#import "base/mac/scoped_nsobject.h" |
| + |
| +@interface ActionSheetCoordinator () { |
| + // Rectangle for the popover alert. |
| + CGRect _rect; |
| + // View for the popovert alert. |
| + base::scoped_nsobject<UIView> _view; |
| +} |
| + |
| +// Override from super. |
| +- (UIAlertController*)alertControllerWithTitle:(NSString*)title |
| + message:(NSString*)message; |
|
lpromero
2016/07/21 21:47:50
Why redeclaring? Isn't that an implementation deta
gambard
2016/07/22 13:51:19
Done.
It was a "reminder" that this function is an
|
| +@end |
| + |
| +@implementation ActionSheetCoordinator |
| + |
| +- (instancetype)initWithBaseViewController:(UIViewController*)viewController |
| + title:(NSString*)title |
| + message:(NSString*)message { |
| + NOTREACHED(); |
| + return nil; |
| +} |
| + |
| +- (instancetype)initWithBaseViewController:(UIViewController*)viewController |
| + title:(NSString*)title |
| + message:(NSString*)message |
| + rect:(CGRect)rect |
| + view:(UIView*)view { |
| + self = [super initWithBaseViewController:viewController |
| + title:title |
| + message:message]; |
| + if (self) { |
| + _rect = rect; |
| + _view.reset(view); |
|
lpromero
2016/07/21 21:47:49
Missing a retain.
gambard
2016/07/22 13:51:19
Done.
|
| + } |
| + return self; |
| +} |
| + |
| +- (UIAlertController*)alertControllerWithTitle:(NSString*)title |
| + message:(NSString*)message { |
| + UIAlertController* alert = [UIAlertController |
| + alertControllerWithTitle:title |
| + message:message |
| + preferredStyle:UIAlertControllerStyleActionSheet]; |
| + |
| + alert.popoverPresentationController.sourceView = _view; |
| + alert.popoverPresentationController.sourceRect = _rect; |
| + |
| + return alert; |
| +} |
| + |
| +@end |