| Index: ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm
|
| diff --git a/ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm b/ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm
|
| index 097c80552457c81497fffa2837335a10dfb56982..9e375d992894f9c2e57da18cb873341b139fc832 100644
|
| --- a/ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm
|
| +++ b/ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm
|
| @@ -4,6 +4,9 @@
|
|
|
| #import "ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.h"
|
|
|
| +#include "base/logging.h"
|
| +#import "ios/clean/chrome/browser/ui/commands/context_menu_commands.h"
|
| +#import "ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h"
|
| #import "ios/clean/chrome/browser/ui/context_menu/context_menu_mediator.h"
|
| #import "ios/clean/chrome/browser/ui/context_menu/context_menu_view_controller.h"
|
| #import "ios/shared/chrome/browser/ui/browser_list/browser.h"
|
| @@ -13,21 +16,51 @@
|
| #error "This file requires ARC support."
|
| #endif
|
|
|
| -@interface WebContextMenuCoordinator ()
|
| -@property(nonatomic, strong) ContextMenuMediator* mediator;
|
| +@interface WebContextMenuCoordinator ()<ContextMenuCommands>
|
| +// The menu context.
|
| +@property(nonatomic, strong, readonly) ContextMenuContextImpl* context;
|
| +// The view controller that displayes the context menu UI.
|
| @property(nonatomic, strong) ContextMenuViewController* viewController;
|
| +
|
| @end
|
|
|
| @implementation WebContextMenuCoordinator
|
| +@synthesize context = _context;
|
| @synthesize viewController = _viewController;
|
| -@synthesize mediator = _mediator;
|
| +
|
| +- (instancetype)initWithContext:(ContextMenuContextImpl*)context {
|
| + if ((self = [super init])) {
|
| + DCHECK(context);
|
| + _context = context;
|
| + }
|
| + return self;
|
| +}
|
| +
|
| +#pragma mark - BrowserCoordinator
|
|
|
| - (void)start {
|
| + id<ContextMenuCommands> contextMenuDispatcher =
|
| + static_cast<id<ContextMenuCommands>>(self.browser->dispatcher());
|
| self.viewController = [[ContextMenuViewController alloc]
|
| - initWithDispatcher:static_cast<id>(self.browser->dispatcher())];
|
| - self.mediator =
|
| - [[ContextMenuMediator alloc] initWithConsumer:self.viewController];
|
| + initWithDispatcher:contextMenuDispatcher];
|
| + [ContextMenuMediator updateConsumer:self.viewController
|
| + withContext:self.context];
|
| + [self.browser->dispatcher()
|
| + startDispatchingToTarget:self
|
| + forSelector:@selector(hideContextMenu:)];
|
| [super start];
|
| }
|
|
|
| +- (void)stop {
|
| + [self.browser->dispatcher() stopDispatchingToTarget:self];
|
| + [super stop];
|
| +}
|
| +
|
| +#pragma mark - ContextMenuCommands
|
| +
|
| +- (void)hideContextMenu:(ContextMenuContext*)context {
|
| + DCHECK_EQ(self.context, context);
|
| + [self stop];
|
| +}
|
| +
|
| @end
|
|
|