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 PresentationConnection_h | 5 #ifndef PresentationConnection_h |
6 #define PresentationConnection_h | 6 #define PresentationConnection_h |
7 | 7 |
| 8 #include <memory> |
8 #include "core/dom/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
9 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
10 #include "core/fileapi/Blob.h" | 11 #include "core/fileapi/Blob.h" |
11 #include "core/fileapi/FileError.h" | 12 #include "core/fileapi/FileError.h" |
12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
13 #include "platform/weborigin/KURL.h" | 14 #include "platform/weborigin/KURL.h" |
14 #include "public/platform/modules/presentation/WebPresentationConnection.h" | 15 #include "public/platform/modules/presentation/WebPresentationConnection.h" |
15 #include "public/platform/modules/presentation/WebPresentationConnectionProxy.h" | 16 #include "public/platform/modules/presentation/WebPresentationConnectionProxy.h" |
16 #include "public/platform/modules/presentation/WebPresentationController.h" | 17 #include "public/platform/modules/presentation/WebPresentationController.h" |
17 #include "public/platform/modules/presentation/WebPresentationSessionInfo.h" | 18 #include "public/platform/modules/presentation/WebPresentationInfo.h" |
18 #include "wtf/text/WTFString.h" | 19 #include "wtf/text/WTFString.h" |
19 #include <memory> | |
20 | 20 |
21 namespace WTF { | 21 namespace WTF { |
22 class AtomicString; | 22 class AtomicString; |
23 } // namespace WTF | 23 } // namespace WTF |
24 | 24 |
25 namespace blink { | 25 namespace blink { |
26 | 26 |
27 class DOMArrayBuffer; | 27 class DOMArrayBuffer; |
28 class DOMArrayBufferView; | 28 class DOMArrayBufferView; |
29 class PresentationController; | 29 class PresentationController; |
30 class PresentationReceiver; | 30 class PresentationReceiver; |
31 class PresentationRequest; | 31 class PresentationRequest; |
32 | 32 |
33 class PresentationConnection final : public EventTargetWithInlineData, | 33 class PresentationConnection final : public EventTargetWithInlineData, |
34 public ContextClient, | 34 public ContextClient, |
35 public WebPresentationConnection { | 35 public WebPresentationConnection { |
36 USING_GARBAGE_COLLECTED_MIXIN(PresentationConnection); | 36 USING_GARBAGE_COLLECTED_MIXIN(PresentationConnection); |
37 DEFINE_WRAPPERTYPEINFO(); | 37 DEFINE_WRAPPERTYPEINFO(); |
38 | 38 |
39 public: | 39 public: |
40 // For CallbackPromiseAdapter. | 40 // For CallbackPromiseAdapter. |
41 static PresentationConnection* take(ScriptPromiseResolver*, | 41 static PresentationConnection* take(ScriptPromiseResolver*, |
42 const WebPresentationSessionInfo&, | 42 const WebPresentationInfo&, |
43 PresentationRequest*); | 43 PresentationRequest*); |
44 static PresentationConnection* take(PresentationController*, | 44 static PresentationConnection* take(PresentationController*, |
45 const WebPresentationSessionInfo&, | 45 const WebPresentationInfo&, |
46 PresentationRequest*); | 46 PresentationRequest*); |
47 static PresentationConnection* take(PresentationReceiver*, | 47 static PresentationConnection* take(PresentationReceiver*, |
48 const WebPresentationSessionInfo&); | 48 const WebPresentationInfo&); |
49 ~PresentationConnection() override; | 49 ~PresentationConnection() override; |
50 | 50 |
51 // EventTarget implementation. | 51 // EventTarget implementation. |
52 const AtomicString& interfaceName() const override; | 52 const AtomicString& interfaceName() const override; |
53 ExecutionContext* getExecutionContext() const override; | 53 ExecutionContext* getExecutionContext() const override; |
54 | 54 |
55 DECLARE_VIRTUAL_TRACE(); | 55 DECLARE_VIRTUAL_TRACE(); |
56 | 56 |
57 const String& id() const { return m_id; } | 57 const String& id() const { return m_id; } |
58 const String& url() const { return m_url; } | 58 const String& url() const { return m_url; } |
59 const WTF::AtomicString& state() const; | 59 const WTF::AtomicString& state() const; |
60 | 60 |
61 void send(const String& message, ExceptionState&); | 61 void send(const String& message, ExceptionState&); |
62 void send(DOMArrayBuffer*, ExceptionState&); | 62 void send(DOMArrayBuffer*, ExceptionState&); |
63 void send(DOMArrayBufferView*, ExceptionState&); | 63 void send(DOMArrayBufferView*, ExceptionState&); |
64 void send(Blob*, ExceptionState&); | 64 void send(Blob*, ExceptionState&); |
65 void close(); | 65 void close(); |
66 void terminate(); | 66 void terminate(); |
67 | 67 |
68 String binaryType() const; | 68 String binaryType() const; |
69 void setBinaryType(const String&); | 69 void setBinaryType(const String&); |
70 | 70 |
71 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
72 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
73 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
74 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate); | 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate); |
75 | 75 |
76 // Returns true if and only if the the session info represents this | 76 // Returns true if and only if the the presentation info matches this |
77 // connection. | 77 // connection. |
78 bool matches(const WebPresentationSessionInfo&) const; | 78 bool matches(const WebPresentationInfo&) const; |
79 | 79 |
80 // Returns true if this connection's id equals to |id| and its url equals to | 80 // Returns true if this connection's id equals to |id| and its url equals to |
81 // |url|. | 81 // |url|. |
82 bool matches(const String& id, const KURL&) const; | 82 bool matches(const String& id, const KURL&) const; |
83 | 83 |
84 // Notifies the connection about its state change to 'closed'. | 84 // Notifies the connection about its state change to 'closed'. |
85 void didClose(WebPresentationConnectionCloseReason, const String& message); | 85 void didClose(WebPresentationConnectionCloseReason, const String& message); |
86 | 86 |
87 // WebPresentationConnection implementation. | 87 // WebPresentationConnection implementation. |
88 void bindProxy(std::unique_ptr<WebPresentationConnectionProxy>) override; | 88 void bindProxy(std::unique_ptr<WebPresentationConnectionProxy>) override; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 HeapDeque<Member<Message>> m_messages; | 137 HeapDeque<Member<Message>> m_messages; |
138 | 138 |
139 BinaryType m_binaryType; | 139 BinaryType m_binaryType; |
140 | 140 |
141 std::unique_ptr<WebPresentationConnectionProxy> m_proxy; | 141 std::unique_ptr<WebPresentationConnectionProxy> m_proxy; |
142 }; | 142 }; |
143 | 143 |
144 } // namespace blink | 144 } // namespace blink |
145 | 145 |
146 #endif // PresentationConnection_h | 146 #endif // PresentationConnection_h |
OLD | NEW |