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

Side by Side Diff: ios/clean/chrome/browser/ui/tab/tab_coordinator.mm

Issue 2734333003: Child coordinators notify their parent upon -start and -stop. (Closed)
Patch Set: Fix tests build (they were on the "all" target) Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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/tab/tab_coordinator.h" 9 #import "ios/clean/chrome/browser/ui/tab/tab_coordinator.h"
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 ToolbarCoordinator* toolbarCoordinator = [[ToolbarCoordinator alloc] init]; 65 ToolbarCoordinator* toolbarCoordinator = [[ToolbarCoordinator alloc] init];
66 toolbarCoordinator.webState = self.webState; 66 toolbarCoordinator.webState = self.webState;
67 [self addChildCoordinator:toolbarCoordinator]; 67 [self addChildCoordinator:toolbarCoordinator];
68 68
69 // Unset the base view controller, so |toolbarCoordinator| doesn't present 69 // Unset the base view controller, so |toolbarCoordinator| doesn't present
70 // its view controller. 70 // its view controller.
71 toolbarCoordinator.context.baseViewController = nil; 71 toolbarCoordinator.context.baseViewController = nil;
72 [toolbarCoordinator start]; 72 [toolbarCoordinator start];
73 73
74 self.viewController.toolbarViewController = toolbarCoordinator.viewController; 74 self.viewController.toolbarViewController = toolbarCoordinator.viewController;
75 self.viewController.contentViewController = webCoordinator.viewController; 75 self.viewController.contentViewController = webCoordinator.viewController;
rohitrao (ping after 24h) 2017/03/08 13:01:03 These two lines are examples of code that should m
lpromero 2017/03/08 13:45:41 Uploading a patch. But is clearly contrived.
lpromero 2017/03/08 13:45:41 The goal (maybe not in this class, but generally s
rohitrao (ping after 24h) 2017/03/08 13:50:23 The goal is to allow it, but that may not always h
76 76
77 // PLACEHOLDER: Replace this placeholder with an actual tab strip view 77 // PLACEHOLDER: Replace this placeholder with an actual tab strip view
78 // controller. 78 // controller.
79 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; 79 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
80 [button addTarget:nil 80 [button addTarget:nil
81 action:@selector(hideTabStrip:) 81 action:@selector(hideTabStrip:)
82 forControlEvents:UIControlEventTouchUpInside]; 82 forControlEvents:UIControlEventTouchUpInside];
83 [button setTitle:@"Hide Strip" forState:UIControlStateNormal]; 83 [button setTitle:@"Hide Strip" forState:UIControlStateNormal];
84 button.frame = CGRectMake(10, 10, 100, 100); 84 button.frame = CGRectMake(10, 10, 100, 100);
85 85
86 UIViewController* tabStripViewController = [[UIViewController alloc] init]; 86 UIViewController* tabStripViewController = [[UIViewController alloc] init];
87 tabStripViewController.view.backgroundColor = [UIColor blackColor]; 87 tabStripViewController.view.backgroundColor = [UIColor blackColor];
88 [tabStripViewController.view addSubview:button]; 88 [tabStripViewController.view addSubview:button];
89 self.viewController.tabStripViewController = tabStripViewController; 89 self.viewController.tabStripViewController = tabStripViewController;
90 90
91 [self.context.baseViewController presentViewController:self.viewController 91 [self.context.baseViewController presentViewController:self.viewController
92 animated:self.context.animated 92 animated:self.context.animated
93 completion:nil]; 93 completion:nil];
94 [super start];
94 } 95 }
95 96
96 - (void)stop { 97 - (void)stop {
98 [super stop];
97 [self.viewController.presentingViewController 99 [self.viewController.presentingViewController
98 dismissViewControllerAnimated:self.context.animated 100 dismissViewControllerAnimated:self.context.animated
99 completion:nil]; 101 completion:nil];
100 _webStateObserver.reset(); 102 _webStateObserver.reset();
101 } 103 }
102 104
103 - (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator { 105 - (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator {
104 // This coordinator will always accept overlay coordinators. 106 // This coordinator will always accept overlay coordinators.
105 return YES; 107 return YES;
106 } 108 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 - (id<UIViewControllerAnimatedTransitioning>) 150 - (id<UIViewControllerAnimatedTransitioning>)
149 animationControllerForDismissedController:(UIViewController*)dismissed { 151 animationControllerForDismissedController:(UIViewController*)dismissed {
150 ZoomTransitionAnimator* animator = [[ZoomTransitionAnimator alloc] init]; 152 ZoomTransitionAnimator* animator = [[ZoomTransitionAnimator alloc] init];
151 animator.presenting = NO; 153 animator.presenting = NO;
152 animator.presentationKey = self.presentationKey; 154 animator.presentationKey = self.presentationKey;
153 [animator selectDelegate:@[ dismissed.presentingViewController ]]; 155 [animator selectDelegate:@[ dismissed.presentingViewController ]];
154 return animator; 156 return animator;
155 } 157 }
156 158
157 @end 159 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698