OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ====== New Architecture ===== | 5 // ====== New Architecture ===== |
6 // = This code is only used in the new iOS Chrome architecture. = | 6 // = This code is only used in the new iOS Chrome architecture. = |
7 // ============================================================================ | 7 // ============================================================================ |
8 | 8 |
9 #import "ios/clean/chrome/browser/ui/tools/tools_coordinator.h" | 9 #import "ios/clean/chrome/browser/ui/tools/tools_coordinator.h" |
10 | 10 |
| 11 #import "ios/clean/chrome/browser/model/browser.h" |
11 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" | 12 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" |
12 #import "ios/clean/chrome/browser/ui/presenters/menu_presentation_controller.h" | 13 #import "ios/clean/chrome/browser/ui/presenters/menu_presentation_controller.h" |
13 #import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h" | 14 #import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h" |
14 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" | 15 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" |
15 | 16 |
16 #if !defined(__has_feature) || !__has_feature(objc_arc) | 17 #if !defined(__has_feature) || !__has_feature(objc_arc) |
17 #error "This file requires ARC support." | 18 #error "This file requires ARC support." |
18 #endif | 19 #endif |
19 | 20 |
20 @interface ToolsCoordinator ()<UIViewControllerTransitioningDelegate> | 21 @interface ToolsCoordinator ()<UIViewControllerTransitioningDelegate> |
21 @property(nonatomic, strong) MenuViewController* menuViewController; | 22 @property(nonatomic, strong) MenuViewController* menuViewController; |
22 @end | 23 @end |
23 | 24 |
24 @implementation ToolsCoordinator | 25 @implementation ToolsCoordinator |
25 @synthesize toolbarCommandHandler = _toolbarCommandHandler; | 26 @synthesize toolbarCommandHandler = _toolbarCommandHandler; |
26 @synthesize menuViewController = _menuViewController; | 27 @synthesize menuViewController = _menuViewController; |
27 | 28 |
28 #pragma mark - BrowserCoordinator | 29 #pragma mark - BrowserCoordinator |
29 | 30 |
30 - (void)start { | 31 - (void)start { |
31 self.menuViewController = [[MenuViewController alloc] init]; | 32 self.menuViewController = [[MenuViewController alloc] init]; |
32 self.menuViewController.modalPresentationStyle = UIModalPresentationCustom; | 33 self.menuViewController.modalPresentationStyle = UIModalPresentationCustom; |
33 self.menuViewController.transitioningDelegate = self; | 34 self.menuViewController.transitioningDelegate = self; |
| 35 self.menuViewController.dispatcher = |
| 36 static_cast<id>(self.browser->dispatcher()); |
34 | 37 |
35 [self.context.baseViewController presentViewController:self.menuViewController | 38 [self.context.baseViewController presentViewController:self.menuViewController |
36 animated:self.context.animated | 39 animated:self.context.animated |
37 completion:nil]; | 40 completion:nil]; |
38 [super start]; | 41 [super start]; |
39 } | 42 } |
40 | 43 |
41 - (void)stop { | 44 - (void)stop { |
42 [super stop]; | 45 [super stop]; |
43 [self.menuViewController.presentingViewController | 46 [self.menuViewController.presentingViewController |
(...skipping 27 matching lines...) Expand all Loading... |
71 sourceViewController:(UIViewController*)source { | 74 sourceViewController:(UIViewController*)source { |
72 MenuPresentationController* menuPresentation = | 75 MenuPresentationController* menuPresentation = |
73 [[MenuPresentationController alloc] | 76 [[MenuPresentationController alloc] |
74 initWithPresentedViewController:presented | 77 initWithPresentedViewController:presented |
75 presentingViewController:presenting]; | 78 presentingViewController:presenting]; |
76 menuPresentation.toolbarCommandHandler = self.toolbarCommandHandler; | 79 menuPresentation.toolbarCommandHandler = self.toolbarCommandHandler; |
77 return menuPresentation; | 80 return menuPresentation; |
78 } | 81 } |
79 | 82 |
80 @end | 83 @end |
OLD | NEW |