OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // ====== New Architecture ===== |
| 6 // = This code is only used in the new iOS Chrome architecture. = |
| 7 // ============================================================================ |
| 8 |
| 9 #ifndef IOS_CHROME_BROWSER_BROWSER_COORDINATOR_INTERNAL_H_ |
| 10 #define IOS_CHROME_BROWSER_BROWSER_COORDINATOR_INTERNAL_H_ |
| 11 |
| 12 #import "ios/chrome/browser/browser_coordinator.h" |
| 13 |
| 14 // Internal API for subclasses and categories of BrowserCoordinator. |
| 15 // |
| 16 // This API can be used to create and manage 'overlay coordinators'. |
| 17 // Overlay coordinators are intended to be used for UI elements that |
| 18 // sit on top of the regular UI, and which may need to be dismissed |
| 19 // by coordinators that don't have direct access to them. Typical uses |
| 20 // would be alerts, login prompts, or other UI that might be dismissed |
| 21 // if (for example) an external event causes a web page to load. |
| 22 // Overlay coordinators can be added by any coordinator in the coordinator |
| 23 // hierarchy, but they will be children of (generally) the topmost |
| 24 // coordinator, regardless of which coordinator added them. |
| 25 @interface BrowserCoordinator (Internal) |
| 26 |
| 27 // Managed view controller of this object. Subclasses must define a |
| 28 // property named |viewController| that has the specific UIViewController |
| 29 // subclass they use; the subclass API will be able to access that view |
| 30 // controller through this property. |
| 31 @property(nonatomic, readonly) UIViewController* viewController; |
| 32 |
| 33 // The child coordinators of this coordinator. To add or remove from this set, |
| 34 // use the -addChildCoordinator: and -removeChildCoordinator: methods. |
| 35 @property(nonatomic, readonly) NSSet<BrowserCoordinator*>* children; |
| 36 |
| 37 // The coordinator that added this coordinator as a child, if any. |
| 38 @property(nonatomic, readonly) BrowserCoordinator* parentCoordinator; |
| 39 |
| 40 // YES if the receiver is acting as an overlay coordinator; NO (the default) |
| 41 // otherwise. |
| 42 @property(nonatomic, readonly) BOOL overlaying; |
| 43 |
| 44 // The coordinator (if any) in the coordinator hierarchy (starting with |
| 45 // the receiver) that is overlaying. If the receiver isn't overlaying, |
| 46 // it recursively asks its children. |
| 47 @property(nonatomic, readonly) BrowserCoordinator* overlayCoordinator; |
| 48 |
| 49 // Adds |coordinator| as a child, taking ownership of it, setting the receiver's |
| 50 // viewController (if any) as the child's rootViewController, and setting |
| 51 // the receiver's browserState as the child's browserState. |
| 52 - (void)addChildCoordinator:(BrowserCoordinator*)coordinator; |
| 53 |
| 54 // Removes |coordinator| as a child, relinquishing ownership of it. If |
| 55 // |coordinator| isn't a child of the receiver, this method does nothing. |
| 56 - (void)removeChildCoordinator:(BrowserCoordinator*)coordinator; |
| 57 |
| 58 // Methods for adding overlay coordinators. |
| 59 |
| 60 // Returns YES if the receiver will take |overlayCoordinator| as a child. |
| 61 // The default is to return YES only if the receiver has no children. |
| 62 - (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator; |
| 63 |
| 64 // Adds |overlayCoordinator| as a child to the receiver, or if it cannot be |
| 65 // added, recursively add it to the receiver's child. If a receiver has |
| 66 // multiple children and returns YES from -canAddOverlayCoordinator:, it |
| 67 // must override this method to determines how the overlay is added. |
| 68 - (void)addOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator; |
| 69 |
| 70 // Removes the current overlay coordinator (if any) as a child from its |
| 71 // parent. |
| 72 - (void)removeOverlayCoordinator; |
| 73 |
| 74 @end |
| 75 |
| 76 #endif // IOS_CHROME_BROWSER_BROWSER_COORDINATOR_INTERNAL_H_ |
OLD | NEW |