forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrome_coordinator.mm
60 lines (47 loc) · 1.38 KB
/
chrome_coordinator.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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.
#import "ios/chrome/browser/chrome_coordinator.h"
#include "base/ios/weak_nsobject.h"
#include "base/logging.h"
#import "base/mac/scoped_nsobject.h"
@interface ChromeCoordinator () {
base::WeakNSObject<UIViewController> _baseViewController;
base::scoped_nsobject<MutableCoordinatorArray> _childCoordinators;
}
@end
@implementation ChromeCoordinator
- (nullable instancetype)initWithBaseViewController:
(UIViewController*)viewController {
if (self = [super init]) {
_baseViewController.reset(viewController);
_childCoordinators.reset([[MutableCoordinatorArray array] retain]);
}
return self;
}
- (nullable instancetype)init {
NOTREACHED();
return nil;
}
- (void)dealloc {
[self stop];
[super dealloc];
}
- (MutableCoordinatorArray*)childCoordinators {
return _childCoordinators;
}
- (ChromeCoordinator*)activeChildCoordinator {
// By default the active child is the one most recently added to the child
// array, but subclasses can override this.
return self.childCoordinators.lastObject;
}
- (nullable UIViewController*)baseViewController {
return _baseViewController;
}
- (void)start {
// Default implementation does nothing.
}
- (void)stop {
// Default implementation does nothing.
}
@end