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/events/EventTarget.h" | 8 #include "core/events/EventTarget.h" |
9 #include "core/fileapi/Blob.h" | 9 #include "core/fileapi/Blob.h" |
10 #include "core/fileapi/FileError.h" | 10 #include "core/fileapi/FileError.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 DECLARE_VIRTUAL_TRACE(); | 46 DECLARE_VIRTUAL_TRACE(); |
47 | 47 |
48 const String& id() const { return m_id; } | 48 const String& id() const { return m_id; } |
49 const WTF::AtomicString& state() const; | 49 const WTF::AtomicString& state() const; |
50 | 50 |
51 void send(const String& message, ExceptionState&); | 51 void send(const String& message, ExceptionState&); |
52 void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&); | 52 void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&); |
53 void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&); | 53 void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&); |
54 void send(Blob*, ExceptionState&); | 54 void send(Blob*, ExceptionState&); |
| 55 void close(); |
55 void terminate(); | 56 void terminate(); |
56 | 57 |
57 String binaryType() const; | 58 String binaryType() const; |
58 void setBinaryType(const String&); | 59 void setBinaryType(const String&); |
59 | 60 |
60 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
61 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
62 | 63 |
63 // Returns true if and only if the WebPresentationConnectionClient represent
s this connection. | 64 // Returns true if and only if the WebPresentationConnectionClient represent
s this connection. |
64 bool matches(WebPresentationConnectionClient*) const; | 65 bool matches(WebPresentationConnectionClient*) const; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 PresentationConnection(LocalFrame*, const String& id, const String& url); | 111 PresentationConnection(LocalFrame*, const String& id, const String& url); |
111 | 112 |
112 bool canSendMessage(ExceptionState&); | 113 bool canSendMessage(ExceptionState&); |
113 void handleMessageQueue(); | 114 void handleMessageQueue(); |
114 | 115 |
115 // Callbacks invoked from BlobLoader. | 116 // Callbacks invoked from BlobLoader. |
116 void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>); | 117 void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>); |
117 void didFailLoadingBlob(FileError::ErrorCode); | 118 void didFailLoadingBlob(FileError::ErrorCode); |
118 | 119 |
119 // Returns true iff current state is closed or terminated. | 120 // Cancel loads and pending messages when the connection is closed. |
120 bool isDisconnected() const; | 121 void tearDown(); |
121 | 122 |
122 String m_id; | 123 String m_id; |
123 String m_url; | 124 String m_url; |
124 WebPresentationConnectionState m_state; | 125 WebPresentationConnectionState m_state; |
125 | 126 |
126 // For Blob data handling. | 127 // For Blob data handling. |
127 Member<BlobLoader> m_blobLoader; | 128 Member<BlobLoader> m_blobLoader; |
128 Deque<OwnPtr<Message>> m_messages; | 129 Deque<OwnPtr<Message>> m_messages; |
129 | 130 |
130 BinaryType m_binaryType; | 131 BinaryType m_binaryType; |
131 }; | 132 }; |
132 | 133 |
133 } // namespace blink | 134 } // namespace blink |
134 | 135 |
135 #endif // PresentationConnection_h | 136 #endif // PresentationConnection_h |
OLD | NEW |