| 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 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 class WebPresentationController; | 13 class WebPresentationController; |
| 13 class WebPresentationSessionClient; | 14 class WebPresentationSessionClient; |
| 14 class WebString; | 15 class WebString; |
| 15 struct WebPresentationError; | 16 struct WebPresentationError; |
| 16 | 17 |
| 17 // If session was created, callback's onSuccess() is invoked with the informatio
n about the | 18 // If session was created, callback's onSuccess() is invoked with the informatio
n about the |
| 18 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code | 19 // presentation session created by the embedder. Otherwise, onError() is invoked
with the error code |
| 19 // and message. | 20 // and message. |
| 20 using WebPresentationSessionClientCallbacks = WebCallbacks<WebPresentationSessio
nClient, WebPresentationError>; | 21 using WebPresentationSessionClientCallbacks = WebCallbacks<WebPresentationSessio
nClient, WebPresentationError>; |
| 21 | 22 |
| 22 // The implementation the embedder has to provide for the Presentation API to wo
rk. | 23 // The implementation the embedder has to provide for the Presentation API to wo
rk. |
| 23 class WebPresentationClient { | 24 class WebPresentationClient { |
| 24 public: | 25 public: |
| 25 virtual ~WebPresentationClient() { } | 26 virtual ~WebPresentationClient() { } |
| 26 | 27 |
| 27 // Passes the Blink-side delegate to the embedder. | 28 // Passes the Blink-side delegate to the embedder. |
| 28 virtual void setController(WebPresentationController*) = 0; | 29 virtual void setController(WebPresentationController*) = 0; |
| 29 | 30 |
| 30 // Called when the frame attaches the first event listener to or removes the | 31 // Called when the frame attaches the first event listener to or removes the |
| 31 // last event listener from the |availablechange| event. | 32 // last event listener from the |availablechange| event. |
| 32 virtual void updateAvailableChangeWatched(bool watched) = 0; | 33 virtual void updateAvailableChangeWatched(bool watched) = 0; |
| 33 | 34 |
| 34 // Called when the frame request to start a new session. | 35 // Called when the frame requests to start a new session. |
| 35 // The ownership of the |callbacks| argument is transferred to the embedder. | 36 // The ownership of the |callbacks| argument is transferred to the embedder. |
| 36 virtual void startSession(const WebString& presentationUrl, const WebString&
presentationId, WebPresentationSessionClientCallbacks*) = 0; | 37 virtual void startSession(const WebString& presentationUrl, const WebString&
presentationId, WebPresentationSessionClientCallbacks*) = 0; |
| 37 | 38 |
| 38 // Called when the frame request to start a new session. | 39 // Called when the frame requests to join an existing session. |
| 39 // The ownership of the |callbacks| argument is transferred to the embedder. | 40 // The ownership of the |callbacks| argument is transferred to the embedder. |
| 40 virtual void joinSession(const WebString& presentationUrl, const WebString&
presentationId, WebPresentationSessionClientCallbacks*) = 0; | 41 virtual void joinSession(const WebString& presentationUrl, const WebString&
presentationId, WebPresentationSessionClientCallbacks*) = 0; |
| 42 |
| 43 // Called when the frame requests to close an existing session. |
| 44 virtual void closeSession(const WebString& url, const WebString& presentatio
nId) |
| 45 { |
| 46 // TODO(haibinlu): make it pure virtual once Chromium has the |
| 47 // implementation. |
| 48 BLINK_ASSERT_NOT_REACHED(); |
| 49 } |
| 41 }; | 50 }; |
| 42 | 51 |
| 43 } // namespace blink | 52 } // namespace blink |
| 44 | 53 |
| 45 #endif // WebPresentationClient_h | 54 #endif // WebPresentationClient_h |
| OLD | NEW |