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 "base/logging.h" | 9 #import "base/logging.h" |
10 #import "ios/clean/chrome/browser/browser_coordinator+internal.h" | 10 #import "ios/clean/chrome/browser/browser_coordinator+internal.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 - (void)addChildCoordinator:(BrowserCoordinator*)coordinator { | 67 - (void)addChildCoordinator:(BrowserCoordinator*)coordinator { |
68 CHECK([self respondsToSelector:@selector(viewController)]) | 68 CHECK([self respondsToSelector:@selector(viewController)]) |
69 << "BrowserCoordinator implementations must provide a viewController " | 69 << "BrowserCoordinator implementations must provide a viewController " |
70 "property."; | 70 "property."; |
71 [self.childCoordinators addObject:coordinator]; | 71 [self.childCoordinators addObject:coordinator]; |
72 coordinator.parentCoordinator = self; | 72 coordinator.parentCoordinator = self; |
73 coordinator.browser = self.browser; | 73 coordinator.browser = self.browser; |
74 coordinator.context.baseViewController = self.viewController; | 74 coordinator.context.baseViewController = self.viewController; |
| 75 [coordinator coordinatorDidMoveToParentCoordinator:self]; |
75 } | 76 } |
76 | 77 |
77 - (BrowserCoordinator*)overlayCoordinator { | 78 - (BrowserCoordinator*)overlayCoordinator { |
78 if (self.overlaying) | 79 if (self.overlaying) |
79 return self; | 80 return self; |
80 for (BrowserCoordinator* child in self.children) { | 81 for (BrowserCoordinator* child in self.children) { |
81 BrowserCoordinator* overlay = child.overlayCoordinator; | 82 BrowserCoordinator* overlay = child.overlayCoordinator; |
82 if (overlay) | 83 if (overlay) |
83 return overlay; | 84 return overlay; |
84 } | 85 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 self.childCoordinators.count == 0; | 120 self.childCoordinators.count == 0; |
120 } | 121 } |
121 | 122 |
122 - (void)removeChildCoordinator:(BrowserCoordinator*)coordinator { | 123 - (void)removeChildCoordinator:(BrowserCoordinator*)coordinator { |
123 if (![self.childCoordinators containsObject:coordinator]) | 124 if (![self.childCoordinators containsObject:coordinator]) |
124 return; | 125 return; |
125 [self.childCoordinators removeObject:coordinator]; | 126 [self.childCoordinators removeObject:coordinator]; |
126 coordinator.parentCoordinator = nil; | 127 coordinator.parentCoordinator = nil; |
127 } | 128 } |
128 | 129 |
| 130 - (void)coordinatorDidMoveToParentCoordinator: |
| 131 (BrowserCoordinator*)parentCoordinator { |
| 132 // Default implementation is a no-op. |
| 133 } |
| 134 |
129 - (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator { | 135 - (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator { |
130 // Default implementation is a no-op. | 136 // Default implementation is a no-op. |
131 } | 137 } |
132 | 138 |
133 - (void)childCoordinatorWillStop:(BrowserCoordinator*)childCoordinator { | 139 - (void)childCoordinatorWillStop:(BrowserCoordinator*)childCoordinator { |
134 // Default implementation is a no-op. | 140 // Default implementation is a no-op. |
135 } | 141 } |
136 | 142 |
137 @end | 143 @end |
OLD | NEW |