Chromium Code Reviews| Index: ios/clean/chrome/browser/ui/overlays/overlay_coordinator.mm |
| diff --git a/ios/clean/chrome/browser/ui/overlays/overlay_coordinator.mm b/ios/clean/chrome/browser/ui/overlays/overlay_coordinator.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3e5e4aa4f7d13a0b33b03a89721d3936a9958434 |
| --- /dev/null |
| +++ b/ios/clean/chrome/browser/ui/overlays/overlay_coordinator.mm |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2017 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/clean/chrome/browser/ui/overlays/overlay_coordinator.h" |
| + |
| +#import "base/logging.h" |
| +#import "ios/clean/chrome/browser/ui/commands/overlay_commands.h" |
| +#import "ios/clean/chrome/browser/ui/overlays/overlay_queue.h" |
| +#import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
| +#import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" |
| +#import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.h" |
| +#import "ios/web/public/web_state/web_state.h" |
| + |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| +@implementation OverlayCoordinator |
| +@synthesize webState = _webState; |
| + |
| +- (instancetype)initWithWebState:(web::WebState*)webState { |
| + DCHECK(webState); |
| + if ((self = [super init])) { |
| + _webState = webState; |
| + } |
| + return self; |
| +} |
| + |
| +#pragma mark - Public |
| + |
| +- (void)startOverlayingCoordinator:(BrowserCoordinator*)coordinator { |
| + DCHECK([coordinator canAddOverlayCoordinator:self]); |
| + [coordinator addOverlayCoordinator:self]; |
|
marq (ping after 24h)
2017/06/14 10:02:32
I think we don't need both the overlay mechanism i
kkhorimoto
2017/06/15 08:26:28
Acknowledged. This patch still uses the existing
|
| + [self start]; |
| +} |
| + |
| +- (void)cancelOverlay { |
| + // Implemented by subclasses. |
|
marq (ping after 24h)
2017/06/14 10:02:32
The header needs to express that this class is int
kkhorimoto
2017/06/15 08:26:28
Done.
|
| +} |
| + |
| +#pragma mark - BrowserCoordinator |
| + |
| +- (void)stop { |
| + [super stop]; |
| + // Stop receiving commands. |
| + [self.browser->dispatcher() stopDispatchingToTarget:self]; |
| + // Remove as the overlay for its parent. |
| + [self.parentCoordinator removeOverlayCoordinator]; |
| + // Notify the WebOverlayQueue that this coordinator has stopped so that it can |
| + // be dequeued. |
| + OverlayQueue::FromWebState(self.webState)->OverlayWasStopped(self); |
| +} |
| + |
| +@end |