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

Side by Side Diff: ios/clean/chrome/browser/ui/overlays/overlay_service.h

Issue 2921833002: [iOS Clean] Created OverlayService.
Patch Set: Use service pattern 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 #ifndef IOS_CLEAN_CHROME_BROWSER_UI_OVERLAYS_OVERLAY_SERVICE_H_
6 #define IOS_CLEAN_CHROME_BROWSER_UI_OVERLAYS_OVERLAY_SERVICE_H_
7
8 #include "base/macros.h"
9 #include "components/keyed_service/core/keyed_service.h"
10
11 namespace web {
12 class WebState;
13 }
14
15 class Browser;
16 @class BrowserCoordinator;
17
18 // OverlayService allows for the easy presentation and dismissal of overlay
marq (ping after 24h) 2017/06/21 09:41:54 The division of responsibilities between the Overl
kkhorimoto 2017/06/23 06:11:16 The main entry point to this overlay system is add
marq (ping after 24h) 2017/06/23 10:42:01 I don't agree that adding this service makes the n
19 // cordinators. Overlays are modal and displayed in the order in which this
20 // service receives them. If an overlay is added to this service while one is
21 // already presented, it will be queued until that current overlay is stopped.
22 class OverlayService : public KeyedService {
23 public:
24 OverlayService() = default;
25 ~OverlayService() override = default;
26
27 // Whether an overlay is currently displayed for |browser|. This will return
28 // true for both WebState-specific or Browser-level overlays.
29 virtual bool IsBrowserShowingOverlay(Browser* browser) const = 0;
30
31 // Replaces |browser|'s currently-visible overlay with |overlay_coordinator|.
32 // The replacement overlay will use the visible overlays parent as its own.
33 // This will replace the current overlay regardless of if it's WebState-
34 // specific.
35 virtual void ReplaceVisibleOverlay(BrowserCoordinator* overlay_coordinator,
36 Browser* browser) = 0;
37
38 // Cancels all scheduled overlays added to this service. If an overlay is
39 // currently visible, it will be stopped.
40 virtual void CancelOverlays() = 0;
41
42 // Browser-specific overlays:
43
44 // Shows |overlay_coordinator| over |parent_coordinator|'s UI.
45 virtual void ShowOverlayForBrowser(BrowserCoordinator* overlay_coordinator,
46 BrowserCoordinator* parent_coordiantor,
47 Browser* browser) = 0;
48
49 // WebState-specific overlays:
50
51 // Switches the active WebState to |web_state| and displays
52 // |overlay_coordinator|'s UI over it.
53 virtual void ShowOverlayForWebState(BrowserCoordinator* overlay_coordinator,
54 web::WebState* web_state) = 0;
55
56 // Cancels all scheduled overlays for |web_state|. If a |web_state|-specific
57 // overlay is currently visible, it will be stopped.
58 virtual void CancelOverlayForWebState(web::WebState* web_state) = 0;
59
60 // Overlays added via ShowOverlayForWebState() can only be started when their
61 // associated WebState's content are is visible. When a coordinator showing
62 // a WebState's content is started, it can notify the OverlayService to use
63 // itself as the parent for that WebState's overlays.
64 virtual void SetWebStateParentCoordinator(
65 BrowserCoordinator* parent_coordinator,
66 web::WebState* web_state) = 0;
67
68 private:
69 DISALLOW_COPY_AND_ASSIGN(OverlayService);
70 };
71
72 #endif // IOS_CLEAN_CHROME_BROWSER_UI_OVERLAYS_OVERLAY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698