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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // EventTarget implementation. | 39 // EventTarget implementation. |
40 virtual const AtomicString& interfaceName() const override; | 40 virtual const AtomicString& interfaceName() const override; |
41 virtual ExecutionContext* executionContext() const override; | 41 virtual ExecutionContext* executionContext() const override; |
42 | 42 |
43 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
44 | 44 |
45 PresentationSession* session() const; | 45 PresentationSession* session() const; |
46 | 46 |
47 ScriptPromise startSession(ScriptState*, const String& presentationUrl, cons
t String& presentationId); | 47 ScriptPromise startSession(ScriptState*, const String& presentationUrl, cons
t String& presentationId); |
48 ScriptPromise joinSession(ScriptState*, const String& presentationUrl, const
String& presentationId); | 48 ScriptPromise joinSession(ScriptState*, const String& presentationUrl, const
String& presentationId); |
| 49 ScriptPromise getAvailability(ScriptState*, const String& presentationUrl); |
49 | 50 |
50 DEFINE_ATTRIBUTE_EVENT_LISTENER(availablechange); | |
51 DEFINE_ATTRIBUTE_EVENT_LISTENER(defaultsessionstart); | 51 DEFINE_ATTRIBUTE_EVENT_LISTENER(defaultsessionstart); |
52 | 52 |
53 // The embedder needs to keep track if anything is listening to the event so
it could stop the | |
54 // might be expensive screen discovery process. | |
55 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture) override; | |
56 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E
ventListener>, bool useCapture) override; | |
57 virtual void removeAllEventListeners() override; | |
58 | |
59 // Called when the |availablechange| event needs to be fired. | |
60 void didChangeAvailability(bool available); | |
61 // Queried by the controller if |availablechange| event has any listeners. | |
62 bool isAvailableChangeWatched() const; | |
63 | |
64 // Called when the |defaultsessionstart| event needs to be fired. | 53 // Called when the |defaultsessionstart| event needs to be fired. |
65 void didStartDefaultSession(PresentationSession*); | 54 void didStartDefaultSession(PresentationSession*); |
66 | 55 |
67 // Called when the |onstatechange| event needs to be fired to the right sess
ion. | 56 // Called when the |onstatechange| event needs to be fired to the right sess
ion. |
68 void didChangeSessionState(WebPresentationSessionClient*, WebPresentationSes
sionState); | 57 void didChangeSessionState(WebPresentationSessionClient*, WebPresentationSes
sionState); |
69 | 58 |
70 // Called when the |onmessage| event needs to be fired to the right session. | 59 // Called when the |onmessage| event needs to be fired to the right session. |
71 void didReceiveSessionTextMessage(WebPresentationSessionClient*, const Strin
g& message); | 60 void didReceiveSessionTextMessage(WebPresentationSessionClient*, const Strin
g& message); |
72 | 61 |
73 // Adds a session to the open sessions list. | 62 // Adds a session to the open sessions list. |
(...skipping 12 matching lines...) Expand all Loading... |
86 // The session object provided to the presentation page. Not supported. | 75 // The session object provided to the presentation page. Not supported. |
87 Member<PresentationSession> m_session; | 76 Member<PresentationSession> m_session; |
88 | 77 |
89 // The sessions opened for this frame. | 78 // The sessions opened for this frame. |
90 HeapHashSet<Member<PresentationSession>> m_openSessions; | 79 HeapHashSet<Member<PresentationSession>> m_openSessions; |
91 }; | 80 }; |
92 | 81 |
93 } // namespace blink | 82 } // namespace blink |
94 | 83 |
95 #endif // Presentation_h | 84 #endif // Presentation_h |
OLD | NEW |