OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebPresentationController_h | 5 #ifndef WebPresentationController_h |
6 #define WebPresentationController_h | 6 #define WebPresentationController_h |
7 | 7 |
8 #include "public/platform/WebCommon.h" | 8 #include "public/platform/WebCommon.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 struct WebPresentationSessionInfo; | 12 struct WebPresentationSessionInfo; |
| 13 class WebPresentationConnection; |
13 class WebString; | 14 class WebString; |
14 | 15 |
15 enum class WebPresentationConnectionCloseReason { Error = 0, Closed, WentAway }; | 16 enum class WebPresentationConnectionCloseReason { Error = 0, Closed, WentAway }; |
16 | 17 |
17 enum class WebPresentationConnectionState { | 18 enum class WebPresentationConnectionState { |
18 Connecting = 0, | 19 Connecting = 0, |
19 Connected, | 20 Connected, |
20 Closed, | 21 Closed, |
21 Terminated, | 22 Terminated, |
22 }; | 23 }; |
23 | 24 |
24 // The delegate Blink provides to WebPresentationClient in order to get updates. | 25 // The delegate Blink provides to WebPresentationClient in order to get updates. |
25 class BLINK_PLATFORM_EXPORT WebPresentationController { | 26 class BLINK_PLATFORM_EXPORT WebPresentationController { |
26 public: | 27 public: |
27 virtual ~WebPresentationController() {} | 28 virtual ~WebPresentationController() {} |
28 | 29 |
29 // Called when the presentation session is started by the embedder using | 30 // Called when the presentation session is started by the embedder using |
30 // the default presentation URL and id. | 31 // the default presentation URL and id. |
31 virtual void didStartDefaultSession(const WebPresentationSessionInfo&) = 0; | 32 virtual WebPresentationConnection* didStartDefaultSession( |
| 33 const WebPresentationSessionInfo&) = 0; |
32 | 34 |
33 // Called when the state of a session changes. | 35 // Called when the state of a session changes. |
34 virtual void didChangeSessionState(const WebPresentationSessionInfo&, | 36 virtual void didChangeSessionState(const WebPresentationSessionInfo&, |
35 WebPresentationConnectionState) = 0; | 37 WebPresentationConnectionState) = 0; |
36 | 38 |
37 // Called when a connection closes. | 39 // Called when a connection closes. |
38 virtual void didCloseConnection(const WebPresentationSessionInfo&, | 40 virtual void didCloseConnection(const WebPresentationSessionInfo&, |
39 WebPresentationConnectionCloseReason, | 41 WebPresentationConnectionCloseReason, |
40 const WebString& message) = 0; | 42 const WebString& message) = 0; |
41 | 43 |
42 // Called when a text message of a session is received. | 44 // Called when a text message of a session is received. |
43 virtual void didReceiveSessionTextMessage(const WebPresentationSessionInfo&, | 45 virtual void didReceiveSessionTextMessage(const WebPresentationSessionInfo&, |
44 const WebString& message) = 0; | 46 const WebString& message) = 0; |
45 | 47 |
46 // Called when a binary message of a session is received. | 48 // Called when a binary message of a session is received. |
47 virtual void didReceiveSessionBinaryMessage(const WebPresentationSessionInfo&, | 49 virtual void didReceiveSessionBinaryMessage(const WebPresentationSessionInfo&, |
48 const uint8_t* data, | 50 const uint8_t* data, |
49 size_t length) = 0; | 51 size_t length) = 0; |
50 }; | 52 }; |
51 | 53 |
52 } // namespace blink | 54 } // namespace blink |
53 | 55 |
54 #endif // WebPresentationController_h | 56 #endif // WebPresentationController_h |
OLD | NEW |