| 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 struct WebPresentationError; | 20 struct WebPresentationError; |
| 20 template <typename T> | 21 template <typename T> |
| 21 class WebVector; | 22 class WebVector; |
| 22 | 23 |
| 23 // If session was created, callback's onSuccess() is invoked with the informatio
n about the | 24 // If session was created, callback's onSuccess() is invoked with the informatio
n about the |
| 24 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code | 25 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code |
| 25 // and message. | 26 // and message. |
| 26 using WebPresentationConnectionClientCallbacks = WebCallbacks<std::unique_ptr<We
bPresentationConnectionClient>, const WebPresentationError&>; | 27 using WebPresentationConnectionClientCallbacks = WebCallbacks<std::unique_ptr<We
bPresentationConnectionClient>, const WebPresentationError&>; |
| 27 | 28 |
| 28 // Callback for .getAvailability(). | 29 // Callback for .getAvailability(). |
| 29 using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, const WebPresent
ationError&>; | 30 using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, const WebPresent
ationError&>; |
| 30 | 31 |
| 31 // The implementation the embedder has to provide for the Presentation API to wo
rk. | 32 // The implementation the embedder has to provide for the Presentation API to wo
rk. |
| 32 // TODO(crbug.com/632623): Use WebURL instead of WebString in this API. | 33 // TODO(crbug.com/632623): Use WebURL instead of WebString in this API. |
| 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<WebString>& presentationUrls, WebP
resentationConnectionClientCallbacks*) = 0; | 46 virtual void startSession(const WebVector<WebString>& presentationUrls, WebP
resentationConnectionClientCallbacks*) = 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<WebString>& presentationUrls, const
WebString& presentationId, WebPresentationConnectionClientCallbacks*) = 0; | 50 virtual void joinSession(const WebVector<WebString>& presentationUrls, const
WebString& 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<WebString>&) = 0; | 86 virtual void setDefaultPresentationUrls(const WebVector<WebString>&) = 0; |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 } // namespace blink | 89 } // namespace blink |
| 86 | 90 |
| 87 #endif // WebPresentationClient_h | 91 #endif // WebPresentationClient_h |
| OLD | NEW |