Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 WebPresentationConnection_h | 5 #ifndef WebPresentationConnection_h |
| 6 #define WebPresentationConnection_h | 6 #define WebPresentationConnection_h |
| 7 | 7 |
| 8 #include "public/platform/WebCommon.h" | 8 #include "public/platform/WebCommon.h" |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 enum class WebPresentationConnectionCloseReason; | |
| 14 enum class WebPresentationConnectionState; | 15 enum class WebPresentationConnectionState; |
| 15 class WebPresentationConnectionProxy; | 16 class WebPresentationConnectionProxy; |
| 16 class WebString; | 17 class WebString; |
| 17 | 18 |
| 18 // Implemented by the embedder for a PresentationConnection. | 19 // Implemented by the embedder for a PresentationConnection. |
| 19 class WebPresentationConnection { | 20 class WebPresentationConnection { |
| 20 public: | 21 public: |
| 21 virtual ~WebPresentationConnection() = default; | 22 virtual ~WebPresentationConnection() = default; |
| 22 | 23 |
| 23 // Takes ownership of |proxy| and stores it in connection object. Should be | 24 // Takes ownership of |proxy| and stores it in connection object. Should be |
| 24 // called only once. | 25 // called only once. |
| 25 virtual void bindProxy(std::unique_ptr<WebPresentationConnectionProxy>) = 0; | 26 virtual void bindProxy(std::unique_ptr<WebPresentationConnectionProxy>) = 0; |
| 26 | 27 |
| 27 // Notifies the presentation about new message. | 28 // Notifies the presentation about new message. |
| 28 virtual void didReceiveTextMessage(const WebString& message) = 0; | 29 virtual void didReceiveTextMessage(const WebString& message) = 0; |
| 29 virtual void didReceiveBinaryMessage(const uint8_t* data, size_t length) = 0; | 30 virtual void didReceiveBinaryMessage(const uint8_t* data, size_t length) = 0; |
| 30 | 31 |
| 31 // Notifies the connection about its state change. | 32 // Notifies the connection about its state change. |
| 32 virtual void didChangeState(WebPresentationConnectionState) = 0; | 33 virtual void didChangeState(WebPresentationConnectionState) = 0; |
| 34 | |
| 35 // Notifies the connection about its state change to 'closed'. | |
| 36 virtual void didClose(WebPresentationConnectionCloseReason, | |
|
mark a. foltz
2017/03/06 18:57:55
Can you remove the message argument since it's alw
zhaobin
2017/03/06 19:52:23
Done.
| |
| 37 const WebString& message) = 0; | |
| 33 }; | 38 }; |
| 34 | 39 |
| 35 } // namespace blink | 40 } // namespace blink |
| 36 | 41 |
| 37 #endif // WebPresentationConnection_h | 42 #endif // WebPresentationConnection_h |
| OLD | NEW |