Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.mm

Issue 2862783002: [iOS Clean] Wired up ContextMenuCommands. (Closed)
Patch Set: fix deps Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698