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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 - (void)addChildCoordinator:(BrowserCoordinator*)coordinator { | 63 - (void)addChildCoordinator:(BrowserCoordinator*)coordinator { |
64 CHECK([self respondsToSelector:@selector(viewController)]) | 64 CHECK([self respondsToSelector:@selector(viewController)]) |
65 << "BrowserCoordinator implementations must provide a viewController " | 65 << "BrowserCoordinator implementations must provide a viewController " |
66 "property."; | 66 "property."; |
67 [self.childCoordinators addObject:coordinator]; | 67 [self.childCoordinators addObject:coordinator]; |
68 coordinator.parentCoordinator = self; | 68 coordinator.parentCoordinator = self; |
69 coordinator.browser = self.browser; | 69 coordinator.browser = self.browser; |
70 coordinator.context.baseViewController = self.viewController; | 70 coordinator.context.baseViewController = self.viewController; |
| 71 [coordinator coordinatorDidMoveToParentCoordinator]; |
71 } | 72 } |
72 | 73 |
73 - (BrowserCoordinator*)overlayCoordinator { | 74 - (BrowserCoordinator*)overlayCoordinator { |
74 if (self.overlaying) | 75 if (self.overlaying) |
75 return self; | 76 return self; |
76 for (BrowserCoordinator* child in self.children) { | 77 for (BrowserCoordinator* child in self.children) { |
77 BrowserCoordinator* overlay = child.overlayCoordinator; | 78 BrowserCoordinator* overlay = child.overlayCoordinator; |
78 if (overlay) | 79 if (overlay) |
79 return overlay; | 80 return overlay; |
80 } | 81 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 self.childCoordinators.count == 0; | 116 self.childCoordinators.count == 0; |
116 } | 117 } |
117 | 118 |
118 - (void)removeChildCoordinator:(BrowserCoordinator*)coordinator { | 119 - (void)removeChildCoordinator:(BrowserCoordinator*)coordinator { |
119 if (![self.childCoordinators containsObject:coordinator]) | 120 if (![self.childCoordinators containsObject:coordinator]) |
120 return; | 121 return; |
121 [self.childCoordinators removeObject:coordinator]; | 122 [self.childCoordinators removeObject:coordinator]; |
122 coordinator.parentCoordinator = nil; | 123 coordinator.parentCoordinator = nil; |
123 } | 124 } |
124 | 125 |
| 126 - (void)coordinatorDidMoveToParentCoordinator { |
| 127 // Default implementation is a no-op. |
| 128 } |
| 129 |
125 - (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator { | 130 - (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator { |
126 // Default implementation is a no-op. | 131 // Default implementation is a no-op. |
127 } | 132 } |
128 | 133 |
129 - (void)childCoordinatorWillStop:(BrowserCoordinator*)childCoordinator { | 134 - (void)childCoordinatorWillStop:(BrowserCoordinator*)childCoordinator { |
130 // Default implementation is a no-op. | 135 // Default implementation is a no-op. |
131 } | 136 } |
132 | 137 |
133 @end | 138 @end |
OLD | NEW |