Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: ios/chrome/browser/browser_coordinator.mm

Issue 2592983003: [Clean Skeleton] Migrate code to clean/ (Closed)
Patch Set: Rebased Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/browser_coordinator.h ('k') | ios/chrome/browser/browser_coordinator+internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/browser_coordinator.mm
diff --git a/ios/chrome/browser/browser_coordinator.mm b/ios/chrome/browser/browser_coordinator.mm
deleted file mode 100644
index f477ab75bf6ec450bf908a7ba389f3e5926c5470..0000000000000000000000000000000000000000
--- a/ios/chrome/browser/browser_coordinator.mm
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// ====== New Architecture =====
-// = This code is only used in the new iOS Chrome architecture. =
-// ============================================================================
-
-#import "base/logging.h"
-#import "ios/chrome/browser/browser_coordinator+internal.h"
-#import "ios/chrome/browser/browser_coordinator.h"
-
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
-@interface BrowserCoordinator ()
-// Child coordinators owned by this object.
-@property(nonatomic, strong)
- NSMutableSet<BrowserCoordinator*>* childCoordinators;
-// Parent coordinator of this object, if any.
-@property(nonatomic, readwrite, weak) BrowserCoordinator* parentCoordinator;
-@property(nonatomic, readwrite) BOOL overlaying;
-@end
-
-@implementation BrowserCoordinator
-
-@synthesize browserState = _browserState;
-@synthesize rootViewController = _rootViewController;
-@synthesize childCoordinators = _childCoordinators;
-@synthesize parentCoordinator = _parentCoordinator;
-@synthesize overlaying = _overlaying;
-
-- (instancetype)init {
- if (self = [super init]) {
- _childCoordinators = [NSMutableSet set];
- }
- return self;
-}
-
-- (void)dealloc {
- [self stop];
-}
-
-#pragma mark - Public API
-
-- (void)start {
- // Default implementation is a no-op.
-}
-
-- (void)stop {
- // Default implementation is a no-op.
-}
-
-@end
-
-@implementation BrowserCoordinator (Internal)
-// Concrete implementations must implement a |viewController| property.
-@dynamic viewController;
-
-- (NSSet*)children {
- return [self.childCoordinators copy];
-}
-
-- (void)addChildCoordinator:(BrowserCoordinator*)coordinator {
- [self.childCoordinators addObject:coordinator];
- coordinator.browserState = self.browserState;
- coordinator.parentCoordinator = self;
- coordinator.rootViewController = self.viewController;
-}
-
-- (BrowserCoordinator*)overlayCoordinator {
- if (self.overlaying)
- return self;
- for (BrowserCoordinator* child in self.children) {
- BrowserCoordinator* overlay = child.overlayCoordinator;
- if (overlay)
- return overlay;
- }
- return nil;
-}
-
-- (void)addOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator {
- // If this object has no children, then add |overlayCoordinator| as a child
- // and mark it as such.
- if ([self canAddOverlayCoordinator:overlayCoordinator]) {
- [self addChildCoordinator:overlayCoordinator];
- overlayCoordinator.overlaying = YES;
- } else if (self.childCoordinators.count == 1) {
- [[self.childCoordinators anyObject]
- addOverlayCoordinator:overlayCoordinator];
- } else {
- CHECK(NO) << "Coordinators with multiple children must explicitly "
- << "handle -addOverlayCoordinator: or return NO to "
- << "-canAddOverlayCoordinator:";
- }
-}
-
-- (void)removeOverlayCoordinator {
- BrowserCoordinator* overlay = self.overlayCoordinator;
- [overlay.parentCoordinator removeChildCoordinator:overlay];
-}
-
-- (BOOL)canAddOverlayCoordinator:(BrowserCoordinator*)overlayCoordinator {
- // By default, coordinators with no other children can add an overlay.
- return self.childCoordinators.count == 0;
-}
-
-- (void)removeChildCoordinator:(BrowserCoordinator*)coordinator {
- [self.childCoordinators removeObject:coordinator];
-}
-
-@end
« no previous file with comments | « ios/chrome/browser/browser_coordinator.h ('k') | ios/chrome/browser/browser_coordinator+internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698