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 WebPresentationClient_h | 5 #ifndef WebPresentationClient_h |
6 #define WebPresentationClient_h | 6 #define WebPresentationClient_h |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
9 #include "public/platform/WebCommon.h" | 9 #include "public/platform/WebCommon.h" |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class WebPresentationAvailabilityObserver; | 15 class WebPresentationAvailabilityObserver; |
16 class WebPresentationController; | 16 class WebPresentationController; |
17 class WebPresentationConnectionClient; | 17 class WebPresentationConnectionClient; |
| 18 class WebPresentationReceiver; |
18 class WebString; | 19 class WebString; |
19 class WebURL; | 20 class WebURL; |
20 struct WebPresentationError; | 21 struct WebPresentationError; |
21 template <typename T> | 22 template <typename T> |
22 class WebVector; | 23 class WebVector; |
23 | 24 |
24 // If session was created, callback's onSuccess() is invoked with the informatio
n about the | 25 // If session was created, callback's onSuccess() is invoked with the informatio
n about the |
25 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code | 26 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code |
26 // and message. | 27 // and message. |
27 using WebPresentationConnectionClientCallbacks = WebCallbacks<std::unique_ptr<We
bPresentationConnectionClient>, const WebPresentationError&>; | 28 using WebPresentationConnectionClientCallbacks = WebCallbacks<std::unique_ptr<We
bPresentationConnectionClient>, const WebPresentationError&>; |
28 | 29 |
29 // Callback for .getAvailability(). | 30 // Callback for .getAvailability(). |
30 using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, const WebPresent
ationError&>; | 31 using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, const WebPresent
ationError&>; |
31 | 32 |
32 // The implementation the embedder has to provide for the Presentation API to wo
rk. | 33 // The implementation the embedder has to provide for the Presentation API to wo
rk. |
33 class WebPresentationClient { | 34 class WebPresentationClient { |
34 public: | 35 public: |
35 virtual ~WebPresentationClient() { } | 36 virtual ~WebPresentationClient() { } |
36 | 37 |
37 // Passes the Blink-side delegate to the embedder. | 38 // Passes the Blink-side delegate to the embedder. |
38 virtual void setController(WebPresentationController*) = 0; | 39 virtual void setController(WebPresentationController*) = 0; |
39 | 40 |
| 41 // Passes the Blink-side delegate to the embedder. |
| 42 virtual void setReceiver(WebPresentationReceiver*) = 0; |
| 43 |
40 // Called when the frame requests to start a new session. | 44 // Called when the frame requests to start a new session. |
41 // The ownership of the |callbacks| argument is transferred to the embedder. | 45 // The ownership of the |callbacks| argument is transferred to the embedder. |
42 virtual void startSession(const WebVector<WebURL>& presentationUrls, WebPres
entationConnectionClientCallbacks*) = 0; | 46 virtual void startSession(const WebVector<WebURL>& presentationUrls, WebPres
entationConnectionClientCallbacks*) = 0; |
43 | 47 |
44 // Called when the frame requests to join an existing session. | 48 // Called when the frame requests to join an existing session. |
45 // The ownership of the |callbacks| argument is transferred to the embedder. | 49 // The ownership of the |callbacks| argument is transferred to the embedder. |
46 virtual void joinSession(const WebVector<WebURL>& presentationUrls, const We
bString& presentationId, WebPresentationConnectionClientCallbacks*) = 0; | 50 virtual void joinSession(const WebVector<WebURL>& presentationUrls, const We
bString& presentationId, WebPresentationConnectionClientCallbacks*) = 0; |
47 | 51 |
48 // Called when the frame requests to send String message to an existing sess
ion. | 52 // Called when the frame requests to send String message to an existing sess
ion. |
49 | 53 |
(...skipping 28 matching lines...) Expand all Loading... |
78 virtual void stopListening(WebPresentationAvailabilityObserver*) = 0; | 82 virtual void stopListening(WebPresentationAvailabilityObserver*) = 0; |
79 | 83 |
80 // Called when a defaultRequest has been set. It sends the url associated | 84 // Called when a defaultRequest has been set. It sends the url associated |
81 // with it for the embedder. | 85 // with it for the embedder. |
82 virtual void setDefaultPresentationUrls(const WebVector<WebURL>&) = 0; | 86 virtual void setDefaultPresentationUrls(const WebVector<WebURL>&) = 0; |
83 }; | 87 }; |
84 | 88 |
85 } // namespace blink | 89 } // namespace blink |
86 | 90 |
87 #endif // WebPresentationClient_h | 91 #endif // WebPresentationClient_h |
OLD | NEW |