OLD | NEW |
(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 |
| 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 overlay's 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-level overlays: |
| 43 |
| 44 // Shows |overlay_coordinator| over |parent_coordinator|'s UI in |browser|. |
| 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. If an overlay is already started, |
| 53 // the active WebState will switch and |overlay_coordinator| will be started |
| 54 // when that one is dismissed. |
| 55 virtual void ShowOverlayForWebState(BrowserCoordinator* overlay_coordinator, |
| 56 web::WebState* web_state) = 0; |
| 57 |
| 58 // Cancels all scheduled overlays for |web_state|. If an overlay is already |
| 59 // being shown for |web_state|, it will be stopped. |
| 60 virtual void CancelOverlayForWebState(web::WebState* web_state) = 0; |
| 61 |
| 62 // Overlays added via ShowOverlayForWebState() can only be started when their |
| 63 // associated WebState's content area is visible. When a coordinator showing |
| 64 // a WebState's content is started, it can use this function to notify the |
| 65 // OverlayService to use itself as the parent for that WebState's overlays. |
| 66 virtual void SetWebStateParentCoordinator( |
| 67 BrowserCoordinator* parent_coordinator, |
| 68 web::WebState* web_state) = 0; |
| 69 |
| 70 private: |
| 71 DISALLOW_COPY_AND_ASSIGN(OverlayService); |
| 72 }; |
| 73 |
| 74 #endif // IOS_CLEAN_CHROME_BROWSER_UI_OVERLAYS_OVERLAY_SERVICE_H_ |
OLD | NEW |