| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
| 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
| 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate); |
| 71 | 71 |
| 72 // Returns true if and only if the the session info represents this | 72 // Returns true if and only if the the session info represents this |
| 73 // connection. | 73 // connection. |
| 74 bool matches(const WebPresentationSessionInfo&) const; | 74 bool matches(const WebPresentationSessionInfo&) const; |
| 75 | 75 |
| 76 // Returns true if this connection's id equals to |id| and its url equals to |
| 77 // |url|. |
| 78 bool matches(const String& id, const KURL&) const; |
| 79 |
| 76 // Notifies the connection about its state change. | 80 // Notifies the connection about its state change. |
| 77 void didChangeState(WebPresentationConnectionState); | 81 void didChangeState(WebPresentationConnectionState); |
| 78 | 82 |
| 79 // Notifies the connection about its state change to 'closed'. | 83 // Notifies the connection about its state change to 'closed'. |
| 80 void didClose(WebPresentationConnectionCloseReason, const String& message); | 84 void didClose(WebPresentationConnectionCloseReason, const String& message); |
| 81 | 85 |
| 82 // Notifies the presentation about new message. | 86 // Notifies the presentation about new message. |
| 83 void didReceiveTextMessage(const String& message); | 87 void didReceiveTextMessage(const String& message); |
| 84 void didReceiveBinaryMessage(const uint8_t* data, size_t length); | 88 void didReceiveBinaryMessage(const uint8_t* data, size_t length); |
| 85 | 89 |
| 90 WebPresentationConnectionState getState(); |
| 91 |
| 86 protected: | 92 protected: |
| 87 // EventTarget implementation. | 93 // EventTarget implementation. |
| 88 void addedEventListener(const AtomicString& eventType, | 94 void addedEventListener(const AtomicString& eventType, |
| 89 RegisteredEventListener&) override; | 95 RegisteredEventListener&) override; |
| 90 | 96 |
| 91 private: | 97 private: |
| 92 class BlobLoader; | 98 class BlobLoader; |
| 93 | 99 |
| 94 enum MessageType { | 100 enum MessageType { |
| 95 MessageTypeText, | 101 MessageTypeText, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 124 // For Blob data handling. | 130 // For Blob data handling. |
| 125 Member<BlobLoader> m_blobLoader; | 131 Member<BlobLoader> m_blobLoader; |
| 126 HeapDeque<Member<Message>> m_messages; | 132 HeapDeque<Member<Message>> m_messages; |
| 127 | 133 |
| 128 BinaryType m_binaryType; | 134 BinaryType m_binaryType; |
| 129 }; | 135 }; |
| 130 | 136 |
| 131 } // namespace blink | 137 } // namespace blink |
| 132 | 138 |
| 133 #endif // PresentationConnection_h | 139 #endif // PresentationConnection_h |
| OLD | NEW |