| 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 #import "ios/clean/chrome/browser/ui/tools/tools_coordinator.h" | 5 #import "ios/clean/chrome/browser/ui/tools/tools_coordinator.h" |
| 6 | 6 |
| 7 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" | 7 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" |
| 8 #import "ios/clean/chrome/browser/ui/presenters/menu_presentation_controller.h" | 8 #import "ios/clean/chrome/browser/ui/presenters/menu_presentation_controller.h" |
| 9 #import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h" | 9 #import "ios/clean/chrome/browser/ui/tools/menu_view_controller.h" |
| 10 #import "ios/clean/chrome/browser/ui/tools/tools_mediator.h" | 10 #import "ios/clean/chrome/browser/ui/tools/tools_mediator.h" |
| 11 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" | |
| 12 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" | 11 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
| 13 | 12 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) | 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." | 14 #error "This file requires ARC support." |
| 16 #endif | 15 #endif |
| 17 | 16 |
| 18 @interface ToolsCoordinator ()<UIViewControllerTransitioningDelegate> | 17 @interface ToolsCoordinator ()<UIViewControllerTransitioningDelegate> |
| 19 @property(nonatomic, strong) MenuViewController* menuViewController; | 18 @property(nonatomic, strong) MenuViewController* viewController; |
| 20 @property(nonatomic, strong) ToolsMediator* mediator; | 19 @property(nonatomic, strong) ToolsMediator* mediator; |
| 21 @end | 20 @end |
| 22 | 21 |
| 23 @implementation ToolsCoordinator | 22 @implementation ToolsCoordinator |
| 24 @synthesize menuViewController = _menuViewController; | 23 @synthesize viewController = _viewController; |
| 25 @synthesize mediator = _mediator; | 24 @synthesize mediator = _mediator; |
| 26 | 25 |
| 27 #pragma mark - BrowserCoordinator | 26 #pragma mark - BrowserCoordinator |
| 28 | 27 |
| 29 - (void)start { | 28 - (void)start { |
| 30 self.menuViewController = [[MenuViewController alloc] init]; | 29 self.viewController = [[MenuViewController alloc] init]; |
| 31 self.menuViewController.modalPresentationStyle = UIModalPresentationCustom; | 30 self.viewController.modalPresentationStyle = UIModalPresentationCustom; |
| 32 self.menuViewController.transitioningDelegate = self; | 31 self.viewController.transitioningDelegate = self; |
| 33 self.menuViewController.dispatcher = | 32 self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher()); |
| 34 static_cast<id>(self.browser->dispatcher()); | 33 self.mediator = [[ToolsMediator alloc] initWithConsumer:self.viewController]; |
| 35 _mediator = [[ToolsMediator alloc] initWithConsumer:self.menuViewController]; | |
| 36 | 34 |
| 37 [self.context.baseViewController presentViewController:self.menuViewController | |
| 38 animated:self.context.animated | |
| 39 completion:nil]; | |
| 40 [super start]; | 35 [super start]; |
| 41 } | 36 } |
| 42 | 37 |
| 43 - (void)stop { | |
| 44 [super stop]; | |
| 45 [self.menuViewController.presentingViewController | |
| 46 dismissViewControllerAnimated:self.context.animated | |
| 47 completion:nil]; | |
| 48 } | |
| 49 | |
| 50 #pragma mark - UIViewControllerTransitioningDelegate | 38 #pragma mark - UIViewControllerTransitioningDelegate |
| 51 | 39 |
| 52 - (id<UIViewControllerAnimatedTransitioning>) | 40 - (id<UIViewControllerAnimatedTransitioning>) |
| 53 animationControllerForPresentedController:(UIViewController*)presented | 41 animationControllerForPresentedController:(UIViewController*)presented |
| 54 presentingController:(UIViewController*)presenting | 42 presentingController:(UIViewController*)presenting |
| 55 sourceController:(UIViewController*)source { | 43 sourceController:(UIViewController*)source { |
| 56 ZoomTransitionAnimator* animator = [[ZoomTransitionAnimator alloc] init]; | 44 ZoomTransitionAnimator* animator = [[ZoomTransitionAnimator alloc] init]; |
| 57 animator.presenting = YES; | 45 animator.presenting = YES; |
| 58 [animator selectDelegate:@[ source, presenting ]]; | 46 [animator selectDelegate:@[ source, presenting ]]; |
| 59 return animator; | 47 return animator; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 sourceViewController:(UIViewController*)source { | 61 sourceViewController:(UIViewController*)source { |
| 74 MenuPresentationController* menuPresentation = | 62 MenuPresentationController* menuPresentation = |
| 75 [[MenuPresentationController alloc] | 63 [[MenuPresentationController alloc] |
| 76 initWithPresentedViewController:presented | 64 initWithPresentedViewController:presented |
| 77 presentingViewController:presenting]; | 65 presentingViewController:presenting]; |
| 78 menuPresentation.dispatcher = static_cast<id>(self.browser->dispatcher()); | 66 menuPresentation.dispatcher = static_cast<id>(self.browser->dispatcher()); |
| 79 return menuPresentation; | 67 return menuPresentation; |
| 80 } | 68 } |
| 81 | 69 |
| 82 @end | 70 @end |
| OLD | NEW |