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

Side by Side Diff: ios/showcase/toolbar/sc_toolbar_coordinator.mm

Issue 2800313002: [ios] RootCoordinator and view controller. (Closed)
Patch Set: Address comments. 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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/showcase/toolbar/sc_toolbar_coordinator.h" 5 #import "ios/showcase/toolbar/sc_toolbar_coordinator.h"
6 6
7 #import "ios/clean/chrome/browser/ui/commands/navigation_commands.h" 7 #import "ios/clean/chrome/browser/ui/commands/navigation_commands.h"
8 #import "ios/clean/chrome/browser/ui/commands/tab_grid_commands.h"
8 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h" 9 #import "ios/clean/chrome/browser/ui/commands/tools_menu_commands.h"
9 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h" 10 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_view_controller.h"
10 #import "ios/showcase/common/protocol_alerter.h" 11 #import "ios/showcase/common/protocol_alerter.h"
11 12
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 13 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 14 #error "This file requires ARC support."
14 #endif 15 #endif
15 16
16 namespace { 17 namespace {
17 // Toolbar height. 18 // Toolbar height.
(...skipping 19 matching lines...) Expand all
37 containerViewController.title = @"Toolbar"; 38 containerViewController.title = @"Toolbar";
38 39
39 UIView* containerView = [[UIView alloc] init]; 40 UIView* containerView = [[UIView alloc] init];
40 [containerViewController.view addSubview:containerView]; 41 [containerViewController.view addSubview:containerView];
41 containerView.backgroundColor = [UIColor redColor]; 42 containerView.backgroundColor = [UIColor redColor];
42 containerView.translatesAutoresizingMaskIntoConstraints = NO; 43 containerView.translatesAutoresizingMaskIntoConstraints = NO;
43 44
44 ToolbarViewController* toolbarViewController = 45 ToolbarViewController* toolbarViewController =
45 [[ToolbarViewController alloc] init]; 46 [[ToolbarViewController alloc] init];
46 toolbarViewController.dispatcher = 47 toolbarViewController.dispatcher =
47 static_cast<id<ToolsMenuCommands, NavigationCommands>>(self.alerter); 48 static_cast<id<TabGridCommands, ToolsMenuCommands, NavigationCommands>>(
49 self.alerter);
48 [containerViewController addChildViewController:toolbarViewController]; 50 [containerViewController addChildViewController:toolbarViewController];
49 toolbarViewController.view.frame = containerView.frame; 51 toolbarViewController.view.frame = containerView.frame;
50 [containerView addSubview:toolbarViewController.view]; 52 [containerView addSubview:toolbarViewController.view];
51 [toolbarViewController didMoveToParentViewController:containerViewController]; 53 [toolbarViewController didMoveToParentViewController:containerViewController];
52 54
53 [NSLayoutConstraint activateConstraints:@[ 55 [NSLayoutConstraint activateConstraints:@[
54 [containerView.heightAnchor constraintEqualToConstant:kToolbarHeight], 56 [containerView.heightAnchor constraintEqualToConstant:kToolbarHeight],
55 [containerView.leadingAnchor 57 [containerView.leadingAnchor
56 constraintEqualToAnchor:containerViewController.view.leadingAnchor], 58 constraintEqualToAnchor:containerViewController.view.leadingAnchor],
57 [containerView.trailingAnchor 59 [containerView.trailingAnchor
58 constraintEqualToAnchor:containerViewController.view.trailingAnchor], 60 constraintEqualToAnchor:containerViewController.view.trailingAnchor],
59 [containerView.centerYAnchor 61 [containerView.centerYAnchor
60 constraintEqualToAnchor:containerViewController.view.centerYAnchor], 62 constraintEqualToAnchor:containerViewController.view.centerYAnchor],
61 ]]; 63 ]];
62 64
63 [self.baseViewController pushViewController:containerViewController 65 [self.baseViewController pushViewController:containerViewController
64 animated:YES]; 66 animated:YES];
65 } 67 }
66 68
67 @end 69 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698