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

Side by Side Diff: ios/clean/chrome/browser/ui/web_contents/overlays/web_overlay_coordinator.mm

Issue 2921833002: [iOS Clean] Created OverlayService.
Patch Set: self review Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 #import "ios/clean/chrome/browser/ui/web_contents/overlays/web_overlay_coordinat or.h"
6
7 #import "base/logging.h"
8 #import "ios/clean/chrome/browser/ui/commands/web_overlay_commands.h"
9 #import "ios/clean/chrome/browser/ui/web_contents/overlays/web_overlay_queue.h"
10 #import "ios/shared/chrome/browser/ui/browser_list/browser.h"
11 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal. h"
12 #import "ios/web/public/web_state/web_state.h"
13
14 #if !defined(__has_feature) || !__has_feature(objc_arc)
15 #error "This file requires ARC support."
16 #endif
17
18 @interface WebOverlayCoordinator () {
19 // The WebState requesting this overlay.
20 web::WebState* _webState;
21 }
22
23 @end
24
25 @implementation WebOverlayCoordinator
26
27 - (instancetype)initWithWebState:(web::WebState*)webState {
28 DCHECK(webState);
29 if ((self = [super init]))
marq (ping after 24h) 2017/06/02 16:14:11 Prefer to have {} around the conditional block in
kkhorimoto 2017/06/03 00:37:32 Acknowledged.
30 _webState = webState;
31 return self;
32 }
33
34 #pragma mark - Public
35
36 - (void)startOverlayingWebCoordinator:(BrowserCoordinator*)webCoordinator {
37 DCHECK([webCoordinator canAddOverlayCoordinator:self]);
38 [webCoordinator addOverlayCoordinator:self];
39 [self start];
40 }
41
42 - (void)cancelWebKitCompletion {
43 // Must be implemented in subclasses.
44 }
45
46 #pragma mark - BrowserCoordinator
47
48 - (void)stop {
49 // Notify the WebOverlayQueue that this coordinator has stopped so that it can
50 // be dequeued.
51 WebOverlayQueue::FromWebState(_webState)->WebOverlayWasStopped(self);
52 // Notify the scheduler that the overlay has stopped.
marq (ping after 24h) 2017/06/02 16:14:11 Move this comment after [super stop].
kkhorimoto 2017/06/03 00:37:32 Acknowledged.
53 [super stop];
54 id<WebOverlaySchedulerCommands> overlayDispatcher =
55 static_cast<id<WebOverlaySchedulerCommands>>(self.browser->dispatcher());
56 [overlayDispatcher webOverlayWasStoppedForWebState:_webState];
57 // Remove as the overlay for its parent.
58 [self.parentCoordinator removeOverlayCoordinator];
59 }
60
61 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698