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 "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
10 #include "core/fileapi/Blob.h" | 10 #include "core/fileapi/Blob.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 WebPresentationConnectionClient represents | 76 // Returns true if and only if the WebPresentationConnectionClient represents |
77 // this connection. | 77 // this connection. |
78 bool matches(WebPresentationConnectionClient*) const; | 78 bool matches(WebPresentationConnectionClient*) const; |
79 | 79 |
| 80 // Returns true if this connection's id equals to |id| and its url equals to |
| 81 // |url|. |
| 82 bool matches(const String& id, const KURL&) const; |
| 83 |
80 // Notifies the connection about its state change. | 84 // Notifies the connection about its state change. |
81 void didChangeState(WebPresentationConnectionState); | 85 void didChangeState(WebPresentationConnectionState); |
82 | 86 |
83 // Notifies the connection about its state change to 'closed'. | 87 // Notifies the connection about its state change to 'closed'. |
84 void didClose(WebPresentationConnectionCloseReason, const String& message); | 88 void didClose(WebPresentationConnectionCloseReason, const String& message); |
85 | 89 |
86 // Notifies the presentation about new message. | 90 // Notifies the presentation about new message. |
87 void didReceiveTextMessage(const String& message); | 91 void didReceiveTextMessage(const String& message); |
88 void didReceiveBinaryMessage(const uint8_t* data, size_t length); | 92 void didReceiveBinaryMessage(const uint8_t* data, size_t length); |
89 | 93 |
| 94 WebPresentationConnectionState getState(); |
| 95 |
90 protected: | 96 protected: |
91 // EventTarget implementation. | 97 // EventTarget implementation. |
92 void addedEventListener(const AtomicString& eventType, | 98 void addedEventListener(const AtomicString& eventType, |
93 RegisteredEventListener&) override; | 99 RegisteredEventListener&) override; |
94 | 100 |
95 private: | 101 private: |
96 class BlobLoader; | 102 class BlobLoader; |
97 | 103 |
98 enum MessageType { | 104 enum MessageType { |
99 MessageTypeText, | 105 MessageTypeText, |
(...skipping 28 matching lines...) Expand all Loading... |
128 // For Blob data handling. | 134 // For Blob data handling. |
129 Member<BlobLoader> m_blobLoader; | 135 Member<BlobLoader> m_blobLoader; |
130 HeapDeque<Member<Message>> m_messages; | 136 HeapDeque<Member<Message>> m_messages; |
131 | 137 |
132 BinaryType m_binaryType; | 138 BinaryType m_binaryType; |
133 }; | 139 }; |
134 | 140 |
135 } // namespace blink | 141 } // namespace blink |
136 | 142 |
137 #endif // PresentationConnection_h | 143 #endif // PresentationConnection_h |
OLD | NEW |