| 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 #ifndef IOS_CHROME_BROWSER_CHROME_COORDINATOR_H_ | 5 #ifndef IOS_CHROME_BROWSER_CHROME_COORDINATOR_H_ |
| 6 #define IOS_CHROME_BROWSER_CHROME_COORDINATOR_H_ | 6 #define IOS_CHROME_BROWSER_CHROME_COORDINATOR_H_ |
| 7 | 7 |
| 8 #include <UIKit/UIKit.h> | 8 #include <UIKit/UIKit.h> |
| 9 | 9 |
| 10 @class ChromeCoordinator; | 10 @class ChromeCoordinator; |
| 11 typedef NSMutableArray<ChromeCoordinator*> MutableCoordinatorArray; | 11 typedef NSMutableArray<ChromeCoordinator*> MutableCoordinatorArray; |
| 12 | 12 |
| 13 // A coordinator object that manages view controllers and other coordinators. | 13 // A coordinator object that manages view controllers and other coordinators. |
| 14 // Members of this class should clean up their own UI when they are deallocated. | 14 // Members of this class should clean up their own UI when they are deallocated. |
| 15 @interface ChromeCoordinator : NSObject | 15 @interface ChromeCoordinator : NSObject |
| 16 | 16 |
| 17 // Creates a coordinator that will use |viewController| | 17 // Creates a coordinator that will use |viewController| |
| 18 - (nullable instancetype)initWithBaseViewController: | 18 - (nullable instancetype)initWithBaseViewController: |
| 19 (nullable UIViewController*)viewController NS_DESIGNATED_INITIALIZER; | 19 (nullable UIViewController*)viewController NS_DESIGNATED_INITIALIZER; |
| 20 | 20 |
| 21 - (nullable instancetype)init NS_UNAVAILABLE; | 21 - (nullable instancetype)init NS_UNAVAILABLE; |
| 22 | 22 |
| 23 // Child coordinators created by this object. | 23 // Child coordinators created by this object. |
| 24 @property(nonatomic, nonnull, readonly) | 24 @property(strong, nonatomic, nonnull, readonly) |
| 25 MutableCoordinatorArray* childCoordinators; | 25 MutableCoordinatorArray* childCoordinators; |
| 26 | 26 |
| 27 // The currently 'active' child coordinator, if any. By default this is the last | 27 // The currently 'active' child coordinator, if any. By default this is the last |
| 28 // coordinator in |childCoordinators|, but subclasses need not adhere to that. | 28 // coordinator in |childCoordinators|, but subclasses need not adhere to that. |
| 29 @property(nonatomic, nullable, readonly) | 29 @property(strong, nonatomic, nullable, readonly) |
| 30 ChromeCoordinator* activeChildCoordinator; | 30 ChromeCoordinator* activeChildCoordinator; |
| 31 | 31 |
| 32 // The view controller this coordinator was initialized with. | 32 // The view controller this coordinator was initialized with. |
| 33 @property(nonatomic, nullable, readonly) UIViewController* baseViewController; | 33 @property(weak, nonatomic, nullable, readonly) |
| 34 UIViewController* baseViewController; |
| 34 | 35 |
| 35 // The basic lifecycle methods for coordinators are -start and -stop. These | 36 // The basic lifecycle methods for coordinators are -start and -stop. These |
| 36 // are blank template methods; child classes are expected to implement them and | 37 // are blank template methods; child classes are expected to implement them and |
| 37 // do not need to invoke the superclass methods. Subclasses of ChromeCoordinator | 38 // do not need to invoke the superclass methods. Subclasses of ChromeCoordinator |
| 38 // that expect to be subclassed should not build functionality into these | 39 // that expect to be subclassed should not build functionality into these |
| 39 // methods. | 40 // methods. |
| 40 // Starts the user interaction managed by the receiver. | 41 // Starts the user interaction managed by the receiver. |
| 41 - (void)start; | 42 - (void)start; |
| 42 | 43 |
| 43 // Stops the user interaction managed by the receiver. Called on dealloc. | 44 // Stops the user interaction managed by the receiver. Called on dealloc. |
| 44 - (void)stop; | 45 - (void)stop; |
| 45 | 46 |
| 46 @end | 47 @end |
| 47 | 48 |
| 48 #endif // IOS_CHROME_BROWSER_CHROME_COORDINATOR_H_ | 49 #endif // IOS_CHROME_BROWSER_CHROME_COORDINATOR_H_ |
| OLD | NEW |