Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/clean/chrome/browser/ui/root/root_container_coordinator.h" | |
| 6 | |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 8 #error "This file requires ARC support." | |
| 9 #endif | |
| 10 | |
| 11 #import "ios/clean/chrome/browser/ui/root/root_container_view_controller.h" | |
| 12 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.h" | |
| 13 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" | |
| 14 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" | |
| 15 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal. h" | |
| 16 | |
| 17 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 18 #error "This file requires ARC support." | |
| 19 #endif | |
| 20 | |
| 21 @interface RootContainerCoordinator () | |
| 22 @property(nonatomic, strong) RootContainerViewController* viewController; | |
| 23 @property(nonatomic, weak) TabGridCoordinator* tabGridCoordinator; | |
| 24 @end | |
| 25 | |
| 26 @implementation RootContainerCoordinator | |
| 27 @synthesize viewController = _viewController; | |
| 28 @synthesize tabGridCoordinator = _tabGridCoordinator; | |
| 29 | |
| 30 #pragma mark - BrowserCoordinator | |
| 31 | |
| 32 - (void)start { | |
| 33 self.viewController = [[RootContainerViewController alloc] init]; | |
| 34 // CommandDispatcher* dispatcher = self.browser->dispatcher(); | |
|
marq (ping after 24h)
2017/04/10 11:04:25
Don't leave code commented out. I agree that we wa
edchin
2017/04/10 16:41:28
Oversight on my part. I was originally planning to
| |
| 35 // [dispatcher startDispatchingToTarget:self forSelector:@selector(loadURL:)]; | |
| 36 | |
| 37 TabGridCoordinator* tabGridCoordinator = [[TabGridCoordinator alloc] init]; | |
| 38 [self addChildCoordinator:tabGridCoordinator]; | |
| 39 [tabGridCoordinator start]; | |
| 40 self.tabGridCoordinator = tabGridCoordinator; | |
| 41 | |
| 42 [super start]; | |
| 43 } | |
| 44 | |
| 45 - (void)stop { | |
| 46 [super stop]; | |
| 47 // PLACEHOLDER: Stop child coordinators here for now. We might deal with this | |
| 48 // differently later on. | |
| 49 for (BrowserCoordinator* child in self.children) { | |
| 50 [child stop]; | |
| 51 } | |
| 52 [self.browser->dispatcher() stopDispatchingToTarget:self]; | |
| 53 } | |
| 54 | |
| 55 - (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator { | |
| 56 self.viewController.contentViewController = childCoordinator.viewController; | |
| 57 } | |
| 58 | |
| 59 - (void)childCoordinatorWillStop:(BrowserCoordinator*)childCoordinator { | |
| 60 self.viewController.contentViewController = nil; | |
| 61 } | |
| 62 | |
| 63 - (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator { | |
| 64 return YES; | |
| 65 } | |
| 66 | |
| 67 #pragma mark - URLOpening | |
| 68 | |
| 69 - (void)openURL:(NSURL*)URL { | |
| 70 [self.tabGridCoordinator openURL:URL]; | |
| 71 } | |
| 72 | |
| 73 @end | |
| OLD | NEW |