Index: ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm |
diff --git a/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm b/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm |
index 4178094ccbf8eccadbcfa3b405c446ce6e7a5c3b..8de910738878202a089a750b5804ec42b346383a 100644 |
--- a/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm |
+++ b/ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.mm |
@@ -4,6 +4,8 @@ |
#import "ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.h" |
+#import "ios/clean/chrome/browser/ui/commands/context_menu_commands.h" |
+ |
#if !defined(__has_feature) || !__has_feature(objc_arc) |
#error "This file requires ARC support." |
#endif |
@@ -21,7 +23,7 @@ @interface ContextMenuViewController () |
@implementation ContextMenuViewController |
@synthesize dispatcher = _dispatcher; |
-- (instancetype)initWithDispatcher:(id)dispatcher { |
+- (instancetype)initWithDispatcher:(id<ContextMenuCommands>)dispatcher { |
self = |
[[self class] alertControllerWithTitle:nil |
message:nil |
@@ -51,9 +53,12 @@ - (void)setContextMenuItems:(NSArray<ContextMenuItem*>*)items { |
} |
// Always add a cancel action. |
+ AlertActionHandler cancelHandler = ^(UIAlertAction* action) { |
+ [self.dispatcher cancelContextMenu]; |
+ }; |
[self addAction:[UIAlertAction actionWithTitle:@"Cancel" |
style:UIAlertActionStyleCancel |
- handler:nil]]; |
+ handler:cancelHandler]]; |
} |
@end |