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 PresentationSession_h | 5 #ifndef PresentationSession_h |
6 #define PresentationSession_h | 6 #define PresentationSession_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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 | 43 |
44 const String id() const { return m_id; } | 44 const String id() const { return m_id; } |
45 const WTF::AtomicString& state() const; | 45 const WTF::AtomicString& state() const; |
46 | 46 |
47 void send(const String& message, ExceptionState&); | 47 void send(const String& message, ExceptionState&); |
48 void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&); | 48 void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&); |
49 void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&); | 49 void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&); |
50 void send(Blob*, ExceptionState&); | 50 void send(Blob*, ExceptionState&); |
51 void close(); | 51 void close(); |
52 | 52 |
53 String binaryType() const; | |
54 void setBinaryType(const String&); | |
55 | |
53 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
54 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 57 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
55 | 58 |
56 // Returns true if and only if the WebPresentationSessionClient represents t his session. | 59 // Returns true if and only if the WebPresentationSessionClient represents t his session. |
57 bool matches(WebPresentationSessionClient*) const; | 60 bool matches(WebPresentationSessionClient*) const; |
58 | 61 |
59 // Notifies the session about its state change. | 62 // Notifies the session about its state change. |
60 void didChangeState(WebPresentationSessionState); | 63 void didChangeState(WebPresentationSessionState); |
61 | 64 |
62 // Notifies the session about new text message. | 65 // Notifies the session about new message. |
63 void didReceiveTextMessage(const String& message); | 66 void didReceiveTextMessage(const String& message); |
67 void didReceiveBinaryMessage(const uint8_t* data, size_t length); | |
64 | 68 |
65 private: | 69 private: |
66 class BlobLoader; | 70 class BlobLoader; |
67 | 71 |
68 enum MessageType { | 72 enum MessageType { |
69 MessageTypeText, | 73 MessageTypeText, |
70 MessageTypeArrayBuffer, | 74 MessageTypeArrayBuffer, |
71 MessageTypeBlob, | 75 MessageTypeBlob, |
72 }; | 76 }; |
73 | 77 |
78 enum BinaryType { | |
79 BinaryTypeBlob, | |
80 BinaryTypeArrayBuffer | |
81 }; | |
82 | |
74 struct Message { | 83 struct Message { |
75 Message(const String& text) | 84 Message(const String& text) |
76 : type(MessageTypeText) | 85 : type(MessageTypeText) |
77 , text(text) { } | 86 , text(text) { } |
78 | 87 |
79 Message(PassRefPtr<DOMArrayBuffer> arrayBuffer) | 88 Message(PassRefPtr<DOMArrayBuffer> arrayBuffer) |
80 : type(MessageTypeArrayBuffer) | 89 : type(MessageTypeArrayBuffer) |
81 , arrayBuffer(arrayBuffer) { } | 90 , arrayBuffer(arrayBuffer) { } |
82 | 91 |
83 Message(PassRefPtr<BlobDataHandle> blobDataHandle) | 92 Message(PassRefPtr<BlobDataHandle> blobDataHandle) |
(...skipping 20 matching lines...) Expand all Loading... | |
104 void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>); | 113 void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>); |
105 void didFailLoadingBlob(FileError::ErrorCode); | 114 void didFailLoadingBlob(FileError::ErrorCode); |
106 | 115 |
107 String m_id; | 116 String m_id; |
108 String m_url; | 117 String m_url; |
109 WebPresentationSessionState m_state; | 118 WebPresentationSessionState m_state; |
110 | 119 |
111 // For Blob data handling. | 120 // For Blob data handling. |
112 Member<BlobLoader> m_blobLoader; | 121 Member<BlobLoader> m_blobLoader; |
113 Deque<OwnPtr<Message>> m_messages; | 122 Deque<OwnPtr<Message>> m_messages; |
123 | |
124 BinaryType m_binaryType; | |
USE s.singapati at gmail.com
2015/07/01 07:17:47
Need to give default value to m_binaryType in Pres
| |
114 }; | 125 }; |
115 | 126 |
116 } // namespace blink | 127 } // namespace blink |
117 | 128 |
118 #endif // PresentationSession_h | 129 #endif // PresentationSession_h |
OLD | NEW |