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_QUEUE_H_ | |
6 #define IOS_CLEAN_CHROME_BROWSER_UI_OVERLAYS_OVERLAY_QUEUE_H_ | |
7 | |
8 #import <Foundation/Foundation.h> | |
9 | |
10 #include "base/observer_list.h" | |
11 #import "ios/clean/chrome/browser/ui/overlays/browser_coordinator+overlay_suppor t.h" | |
12 #import "ios/clean/chrome/browser/ui/overlays/overlay_queue_observer.h" | |
13 | |
14 namespace web { | |
15 class WebState; | |
16 } | |
17 | |
18 // Class used to enqueue BrowserCoordinators. It uses OverlayQueueObservers to | |
19 // communicate changes in the queue. | |
20 class OverlayQueue { | |
21 public: | |
22 virtual ~OverlayQueue(); | |
23 | |
24 // Adds and removes OverlayQueueObservers. | |
25 void AddObserver(OverlayQueueObserver* observer); | |
26 void RemoveObserver(OverlayQueueObserver* observer); | |
27 | |
28 // Starts the next overlay in the queue. If GetWebState() returns non-null, | |
29 // it is expected that its content area is visible before this is called. | |
30 virtual void StartNextOverlay() = 0; | |
31 // Called to notify the OverlayQueue that |overlay_coordinator| was stopped. | |
32 virtual void OverlayWasStopped(BrowserCoordinator* overlay_coordinator); | |
33 // Removes the currently displayed overlay and adds |overlay_coordinator| to | |
34 // the front of the queue to be displayed immediately. | |
35 virtual void ReplaceVisibleOverlay(BrowserCoordinator* overlay_coordinator); | |
36 // Returns whether there are any queued overlays. | |
37 bool HasQueuedOverlays() const; | |
38 // Returns whether an overlay is curently started. | |
39 bool IsShowingOverlay() const; | |
40 // Cancels all queued overlays for this queue. If one is being displayed, it | |
41 // will also be stopped | |
42 void CancelOverlays(); | |
43 | |
44 // Some OverlayQueues require that a particular WebState's content area is | |
45 // visible before its queued BrowserCoordinators can be started. If this | |
46 // queue's overlays require showing a WebState, this function will return that | |
47 // WebState. | |
48 virtual web::WebState* GetWebState() const; | |
49 | |
50 protected: | |
51 // Adds |overlay_coordinator| to the queue and schedules its presentation. | |
52 void AddOverlay(BrowserCoordinator* overlay_coordinator); | |
53 // Returns the number of overlays in the queue. | |
54 NSUInteger GetCount() const; | |
55 // Returns the first BrowserCoordinator in the queue. | |
56 BrowserCoordinator* GetFirstOverlay(); | |
57 // Called when the first overlay in the queue is started. | |
58 void OverlayWasStarted(); | |
59 // Default constructor. | |
60 OverlayQueue(); | |
61 | |
62 private: | |
63 // The observers for this queue. | |
64 base::ObserverList<OverlayQueueObserver> observers_; | |
65 // The queue of overlays that were added for this WebState. | |
66 NSMutableArray<BrowserCoordinator*>* overlays_; | |
marq (ping after 24h)
2017/06/21 09:41:53
Please explicitly mark ObjC member variables '__st
kkhorimoto
2017/06/23 06:11:15
Done.
| |
67 // Whether an overlay is currently started. If this is true, the first | |
68 // BrowserCoordinator in |overlays_| is started. | |
marq (ping after 24h)
2017/06/21 09:41:53
s/is started/has been started/ to clarify what the
kkhorimoto
2017/06/23 06:11:16
Done.
| |
69 bool showing_overlay_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(OverlayQueue); | |
72 }; | |
73 | |
74 #endif // IOS_CLEAN_CHROME_BROWSER_UI_OVERLAYS_OVERLAY_QUEUE_H_ | |
OLD | NEW |