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

Unified Diff: ios/clean/chrome/browser/ui/root/root_container_coordinator.mm

Issue 2800313002: [ios] RootCoordinator and view controller. (Closed)
Patch Set: Created 3 years, 8 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/root/root_container_coordinator.mm
diff --git a/ios/clean/chrome/browser/ui/root/root_container_coordinator.mm b/ios/clean/chrome/browser/ui/root/root_container_coordinator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..15958aaef74a53e4062e9c14a3233bbd4ca8e18d
--- /dev/null
+++ b/ios/clean/chrome/browser/ui/root/root_container_coordinator.mm
@@ -0,0 +1,73 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/clean/chrome/browser/ui/root/root_container_coordinator.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+#import "ios/clean/chrome/browser/ui/root/root_container_view_controller.h"
+#import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.h"
+#import "ios/shared/chrome/browser/ui/browser_list/browser.h"
+#import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h"
+#import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface RootContainerCoordinator ()
+@property(nonatomic, strong) RootContainerViewController* viewController;
+@property(nonatomic, weak) TabGridCoordinator* tabGridCoordinator;
+@end
+
+@implementation RootContainerCoordinator
+@synthesize viewController = _viewController;
+@synthesize tabGridCoordinator = _tabGridCoordinator;
+
+#pragma mark - BrowserCoordinator
+
+- (void)start {
+ self.viewController = [[RootContainerViewController alloc] init];
+ // 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
+ // [dispatcher startDispatchingToTarget:self forSelector:@selector(loadURL:)];
+
+ TabGridCoordinator* tabGridCoordinator = [[TabGridCoordinator alloc] init];
+ [self addChildCoordinator:tabGridCoordinator];
+ [tabGridCoordinator start];
+ self.tabGridCoordinator = tabGridCoordinator;
+
+ [super start];
+}
+
+- (void)stop {
+ [super stop];
+ // PLACEHOLDER: Stop child coordinators here for now. We might deal with this
+ // differently later on.
+ for (BrowserCoordinator* child in self.children) {
+ [child stop];
+ }
+ [self.browser->dispatcher() stopDispatchingToTarget:self];
+}
+
+- (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator {
+ self.viewController.contentViewController = childCoordinator.viewController;
+}
+
+- (void)childCoordinatorWillStop:(BrowserCoordinator*)childCoordinator {
+ self.viewController.contentViewController = nil;
+}
+
+- (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator {
+ return YES;
+}
+
+#pragma mark - URLOpening
+
+- (void)openURL:(NSURL*)URL {
+ [self.tabGridCoordinator openURL:URL];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698