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

Side by Side Diff: ios/clean/chrome/browser/ui/root/root_container_view_controller.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 unified diff | Download patch
OLDNEW
(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_view_controller.h"
6
7 #if !defined(__has_feature) || !__has_feature(objc_arc)
8 #error "This file requires ARC support."
9 #endif
10
11 @implementation RootContainerViewController
12 @synthesize contentViewController = _contentViewController;
13
14 #pragma mark - UIViewController
15
16 - (void)viewDidLoad {
17 [super viewDidLoad];
18 self.view.backgroundColor = [UIColor blackColor];
19 [self attachChildViewController:self.contentViewController];
20 }
21
22 #pragma mark - Public properties
23
24 - (void)setContentViewController:(UIViewController*)contentViewController {
25 if (self.contentViewController == contentViewController)
26 return;
27 if ([self isViewLoaded]) {
28 [self detachChildViewController:self.contentViewController];
29 [self attachChildViewController:contentViewController];
30 }
31 _contentViewController = contentViewController;
32 }
33
34 #pragma mark - ChildViewController helper methods
35
36 - (void)attachChildViewController:(UIViewController*)viewController {
37 if (!viewController) {
38 return;
39 }
40 [self addChildViewController:viewController];
41 viewController.view.translatesAutoresizingMaskIntoConstraints = YES;
marq (ping after 24h) 2017/04/10 11:04:25 This is the default, no need to set it.
edchin 2017/04/10 16:41:28 Done.
42 viewController.view.autoresizingMask =
43 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
44 viewController.view.frame = self.view.bounds;
45 [self.view addSubview:viewController.view];
46 [viewController didMoveToParentViewController:self];
47 }
48
49 - (void)detachChildViewController:(UIViewController*)viewController {
50 if (viewController.parentViewController != self)
51 return;
52 [viewController willMoveToParentViewController:nil];
53 [viewController.view removeFromSuperview];
54 [viewController removeFromParentViewController];
55 }
56
57 #pragma mark - ZoomTransitionDelegate
58
59 - (CGRect)rectForZoomWithKey:(NSObject*)key inView:(UIView*)view {
marq (ping after 24h) 2017/04/10 11:04:25 No change for now, but I'd like to figure out a wa
edchin 2017/04/10 16:41:28 Could not agree more.
60 if ([self.contentViewController
61 conformsToProtocol:@protocol(ZoomTransitionDelegate)]) {
62 return [reinterpret_cast<id<ZoomTransitionDelegate>>(
marq (ping after 24h) 2017/04/10 11:04:25 Despite what I might have said in the past, this s
edchin 2017/04/10 16:41:28 Done.
63 self.contentViewController) rectForZoomWithKey:key
64 inView:view];
65 }
66 return CGRectNull;
67 }
68
69 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698