OLD | NEW |
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 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/mac/foundation_util.h" | 13 #include "base/mac/foundation_util.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #import "ios/clean/chrome/browser/browser_coordinator+internal.h" | 15 #import "ios/clean/chrome/browser/browser_coordinator+internal.h" |
| 16 #import "ios/clean/chrome/browser/ui/actions/tab_grid_actions.h" |
16 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" | 17 #import "ios/clean/chrome/browser/ui/animators/zoom_transition_animator.h" |
17 #import "ios/clean/chrome/browser/ui/tab/tab_container_view_controller.h" | 18 #import "ios/clean/chrome/browser/ui/tab/tab_container_view_controller.h" |
18 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.h" | 19 #import "ios/clean/chrome/browser/ui/toolbar/toolbar_coordinator.h" |
19 #import "ios/clean/chrome/browser/ui/web_contents/web_coordinator.h" | 20 #import "ios/clean/chrome/browser/ui/web_contents/web_coordinator.h" |
20 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" | 21 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" |
21 #import "ios/web/public/web_state/web_state_observer_bridge.h" | 22 #import "ios/web/public/web_state/web_state_observer_bridge.h" |
22 | 23 |
23 #if !defined(__has_feature) || !__has_feature(objc_arc) | 24 #if !defined(__has_feature) || !__has_feature(objc_arc) |
24 #error "This file requires ARC support." | 25 #error "This file requires ARC support." |
25 #endif | 26 #endif |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 _webStateObserver = base::MakeUnique<web::WebStateObserverBridge>( | 63 _webStateObserver = base::MakeUnique<web::WebStateObserverBridge>( |
63 self.webState, toolbarCoordinator); | 64 self.webState, toolbarCoordinator); |
64 // Unset the base view controller, so |toolbarCoordinator| doesn't present | 65 // Unset the base view controller, so |toolbarCoordinator| doesn't present |
65 // its view controller. | 66 // its view controller. |
66 toolbarCoordinator.context.baseViewController = nil; | 67 toolbarCoordinator.context.baseViewController = nil; |
67 [toolbarCoordinator start]; | 68 [toolbarCoordinator start]; |
68 | 69 |
69 self.viewController.toolbarViewController = toolbarCoordinator.viewController; | 70 self.viewController.toolbarViewController = toolbarCoordinator.viewController; |
70 self.viewController.contentViewController = webCoordinator.viewController; | 71 self.viewController.contentViewController = webCoordinator.viewController; |
71 | 72 |
| 73 // PLACEHOLDER: Replace this placeholder with an actual tab strip view |
| 74 // controller. |
| 75 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 76 [button addTarget:nil |
| 77 action:@selector(showTabGrid:) |
| 78 forControlEvents:UIControlEventTouchUpInside]; |
| 79 [button setTitle:@"Tab grid" forState:UIControlStateNormal]; |
| 80 button.frame = CGRectMake(10, 10, 100, 100); |
| 81 |
| 82 UIViewController* tabStripViewController = [[UIViewController alloc] init]; |
| 83 tabStripViewController.view.backgroundColor = [UIColor blackColor]; |
| 84 [tabStripViewController.view addSubview:button]; |
| 85 self.viewController.tabStripViewController = tabStripViewController; |
| 86 |
72 [self.context.baseViewController presentViewController:self.viewController | 87 [self.context.baseViewController presentViewController:self.viewController |
73 animated:self.context.animated | 88 animated:self.context.animated |
74 completion:nil]; | 89 completion:nil]; |
75 } | 90 } |
76 | 91 |
77 - (void)stop { | 92 - (void)stop { |
78 [self.viewController.presentingViewController | 93 [self.viewController.presentingViewController |
79 dismissViewControllerAnimated:self.context.animated | 94 dismissViewControllerAnimated:self.context.animated |
80 completion:nil]; | 95 completion:nil]; |
81 _webStateObserver.reset(); | 96 _webStateObserver.reset(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 - (id<UIViewControllerAnimatedTransitioning>) | 129 - (id<UIViewControllerAnimatedTransitioning>) |
115 animationControllerForDismissedController:(UIViewController*)dismissed { | 130 animationControllerForDismissedController:(UIViewController*)dismissed { |
116 ZoomTransitionAnimator* animator = [[ZoomTransitionAnimator alloc] init]; | 131 ZoomTransitionAnimator* animator = [[ZoomTransitionAnimator alloc] init]; |
117 animator.presenting = NO; | 132 animator.presenting = NO; |
118 animator.presentationKey = self.presentationKey; | 133 animator.presentationKey = self.presentationKey; |
119 [animator selectDelegate:@[ dismissed.presentingViewController ]]; | 134 [animator selectDelegate:@[ dismissed.presentingViewController ]]; |
120 return animator; | 135 return animator; |
121 } | 136 } |
122 | 137 |
123 @end | 138 @end |
OLD | NEW |