OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef Presentation_h | 5 #ifndef Presentation_h |
6 #define Presentation_h | 6 #define Presentation_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
10 #include "core/frame/DOMWindowProperty.h" | 10 #include "core/frame/DOMWindowProperty.h" |
11 #include "modules/presentation/PresentationSession.h" | 11 #include "modules/presentation/PresentationSession.h" |
12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
13 #include "platform/heap/Heap.h" | 13 #include "platform/heap/Heap.h" |
14 | 14 |
15 namespace WTF { | 15 namespace WTF { |
16 class String; | 16 class String; |
17 } // namespace WTF | 17 } // namespace WTF |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class LocalFrame; | 21 class LocalFrame; |
22 class PresentationController; | 22 class PresentationController; |
23 class ScriptState; | 23 class ScriptState; |
| 24 class WebPresentationSessionClient; |
| 25 enum class WebPresentationSessionState; |
24 | 26 |
25 // Implements the main entry point of the Presentation API corresponding to the
Presentation.idl | 27 // Implements the main entry point of the Presentation API corresponding to the
Presentation.idl |
26 // See https://w3c.github.io/presentation-api/#navigatorpresentation for details
. | 28 // See https://w3c.github.io/presentation-api/#navigatorpresentation for details
. |
27 class Presentation final | 29 class Presentation final |
28 : public RefCountedGarbageCollectedEventTargetWithInlineData<Presentation> | 30 : public RefCountedGarbageCollectedEventTargetWithInlineData<Presentation> |
29 , public DOMWindowProperty { | 31 , public DOMWindowProperty { |
30 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P
resentation>); | 32 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P
resentation>); |
31 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Presentation); | 33 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Presentation); |
32 DEFINE_WRAPPERTYPEINFO(); | 34 DEFINE_WRAPPERTYPEINFO(); |
33 public: | 35 public: |
(...skipping 21 matching lines...) Expand all Loading... |
55 virtual void removeAllEventListeners() override; | 57 virtual void removeAllEventListeners() override; |
56 | 58 |
57 // Called when the |availablechange| event needs to be fired. | 59 // Called when the |availablechange| event needs to be fired. |
58 void didChangeAvailability(bool available); | 60 void didChangeAvailability(bool available); |
59 // Queried by the controller if |availablechange| event has any listeners. | 61 // Queried by the controller if |availablechange| event has any listeners. |
60 bool isAvailableChangeWatched() const; | 62 bool isAvailableChangeWatched() const; |
61 | 63 |
62 // Called when the |defaultsessionstart| event needs to be fired. | 64 // Called when the |defaultsessionstart| event needs to be fired. |
63 void didStartDefaultSession(PresentationSession*); | 65 void didStartDefaultSession(PresentationSession*); |
64 | 66 |
| 67 // Called when the |onstatechange| event needs to be fired to the right sess
ion. |
| 68 void didChangeSessionState(WebPresentationSessionClient*, WebPresentationSes
sionState); |
| 69 |
65 // Adds a session to the open sessions list. | 70 // Adds a session to the open sessions list. |
66 void registerSession(PresentationSession*); | 71 void registerSession(PresentationSession*); |
67 | 72 |
68 private: | 73 private: |
69 explicit Presentation(LocalFrame*); | 74 explicit Presentation(LocalFrame*); |
70 | 75 |
71 // Returns the |PresentationController| object associated with the frame |Pr
esentation| corresponds to. | 76 // Returns the |PresentationController| object associated with the frame |Pr
esentation| corresponds to. |
72 // Can return |nullptr| if the frame is detached from the document. | 77 // Can return |nullptr| if the frame is detached from the document. |
73 PresentationController* presentationController(); | 78 PresentationController* presentationController(); |
74 | 79 |
| 80 // Returns the session that matches the WebPresentationSessionClient or null
. |
| 81 PresentationSession* findSession(WebPresentationSessionClient*); |
| 82 |
75 // The session object provided to the presentation page. Not supported. | 83 // The session object provided to the presentation page. Not supported. |
76 Member<PresentationSession> m_session; | 84 Member<PresentationSession> m_session; |
77 | 85 |
78 // The sessions opened for this frame. | 86 // The sessions opened for this frame. |
79 HeapHashSet<Member<PresentationSession>> m_openSessions; | 87 HeapHashSet<Member<PresentationSession>> m_openSessions; |
80 }; | 88 }; |
81 | 89 |
82 } // namespace blink | 90 } // namespace blink |
83 | 91 |
84 #endif // Presentation_h | 92 #endif // Presentation_h |
OLD | NEW |