| 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 WebString; | 18 class WebString; |
| 19 struct WebPresentationError; | 19 struct WebPresentationError; |
| 20 template <typename T> |
| 21 class WebVector; |
| 20 | 22 |
| 21 // If session was created, callback's onSuccess() is invoked with the informatio
n about the | 23 // If session was created, callback's onSuccess() is invoked with the informatio
n about the |
| 22 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code | 24 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code |
| 23 // and message. | 25 // and message. |
| 24 using WebPresentationConnectionClientCallbacks = WebCallbacks<std::unique_ptr<We
bPresentationConnectionClient>, const WebPresentationError&>; | 26 using WebPresentationConnectionClientCallbacks = WebCallbacks<std::unique_ptr<We
bPresentationConnectionClient>, const WebPresentationError&>; |
| 25 | 27 |
| 26 // Callback for .getAvailability(). | 28 // Callback for .getAvailability(). |
| 27 using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, const WebPresent
ationError&>; | 29 using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, const WebPresent
ationError&>; |
| 28 | 30 |
| 29 // The implementation the embedder has to provide for the Presentation API to wo
rk. | 31 // The implementation the embedder has to provide for the Presentation API to wo
rk. |
| 30 class WebPresentationClient { | 32 class WebPresentationClient { |
| 31 public: | 33 public: |
| 32 virtual ~WebPresentationClient() { } | 34 virtual ~WebPresentationClient() { } |
| 33 | 35 |
| 34 // Passes the Blink-side delegate to the embedder. | 36 // Passes the Blink-side delegate to the embedder. |
| 35 virtual void setController(WebPresentationController*) = 0; | 37 virtual void setController(WebPresentationController*) = 0; |
| 36 | 38 |
| 37 // Called when the frame requests to start a new session. | 39 // Called when the frame requests to start a new session. |
| 38 // The ownership of the |callbacks| argument is transferred to the embedder. | 40 // The ownership of the |callbacks| argument is transferred to the embedder. |
| 39 virtual void startSession(const WebString& presentationUrl, WebPresentationC
onnectionClientCallbacks*) = 0; | 41 virtual void startSession(const WebVector<WebString>& presentationUrls, WebP
resentationConnectionClientCallbacks*) = 0; |
| 40 | 42 |
| 41 // Called when the frame requests to join an existing session. | 43 // Called when the frame requests to join an existing session. |
| 42 // The ownership of the |callbacks| argument is transferred to the embedder. | 44 // The ownership of the |callbacks| argument is transferred to the embedder. |
| 43 virtual void joinSession(const WebString& presentationUrl, const WebString&
presentationId, WebPresentationConnectionClientCallbacks*) = 0; | 45 virtual void joinSession(const WebVector<WebString>& presentationUrls, const
WebString& presentationId, WebPresentationConnectionClientCallbacks*) = 0; |
| 44 | 46 |
| 45 // Called when the frame requests to send String message to an existing sess
ion. | 47 // Called when the frame requests to send String message to an existing sess
ion. |
| 46 virtual void sendString(const WebString& presentationUrl, const WebString& p
resentationId, const WebString& message) = 0; | 48 virtual void sendString(const WebString& presentationUrl, const WebString& p
resentationId, const WebString& message) = 0; |
| 47 | 49 |
| 48 // Called when the frame requests to send ArrayBuffer/View data to an existi
ng session. | 50 // Called when the frame requests to send ArrayBuffer/View data to an existi
ng session. |
| 49 // Embedder copies the |data| and the ownership is not transferred. | 51 // Embedder copies the |data| and the ownership is not transferred. |
| 50 virtual void sendArrayBuffer(const WebString& presentationUrl, const WebStri
ng& presentationId, const uint8_t* data, size_t length) = 0; | 52 virtual void sendArrayBuffer(const WebString& presentationUrl, const WebStri
ng& presentationId, const uint8_t* data, size_t length) = 0; |
| 51 | 53 |
| 52 // Called when the frame requests to send Blob data to an existing session. | 54 // Called when the frame requests to send Blob data to an existing session. |
| 53 // Embedder copies the |data| and the ownership is not transferred. | 55 // Embedder copies the |data| and the ownership is not transferred. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 68 // observer will be notified in case of a change. The observer is | 70 // observer will be notified in case of a change. The observer is |
| 69 // respensible to call stopListening() before being destroyed. | 71 // respensible to call stopListening() before being destroyed. |
| 70 virtual void startListening(WebPresentationAvailabilityObserver*) = 0; | 72 virtual void startListening(WebPresentationAvailabilityObserver*) = 0; |
| 71 | 73 |
| 72 // Stop listening to changes in presentation displays availability. The | 74 // Stop listening to changes in presentation displays availability. The |
| 73 // observer will no longer be notified in case of a change. | 75 // observer will no longer be notified in case of a change. |
| 74 virtual void stopListening(WebPresentationAvailabilityObserver*) = 0; | 76 virtual void stopListening(WebPresentationAvailabilityObserver*) = 0; |
| 75 | 77 |
| 76 // Called when a defaultRequest has been set. It sends the url associated | 78 // Called when a defaultRequest has been set. It sends the url associated |
| 77 // with it for the embedder. | 79 // with it for the embedder. |
| 78 virtual void setDefaultPresentationUrl(const WebString&) = 0; | 80 virtual void setDefaultPresentationUrls(const WebVector<WebString>&) = 0; |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace blink | 83 } // namespace blink |
| 82 | 84 |
| 83 #endif // WebPresentationClient_h | 85 #endif // WebPresentationClient_h |
| OLD | NEW |