Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h

Issue 2327993002: [PresentationAPI] Use KURL and WebURL in place of string types. (Closed)
Patch Set: Address imcheng@ comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 class WebURL;
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 class WebPresentationClient { 33 class WebPresentationClient {
34 public: 34 public:
35 virtual ~WebPresentationClient() { } 35 virtual ~WebPresentationClient() { }
36 36
37 // Passes the Blink-side delegate to the embedder. 37 // Passes the Blink-side delegate to the embedder.
38 virtual void setController(WebPresentationController*) = 0; 38 virtual void setController(WebPresentationController*) = 0;
39 39
40 // Called when the frame requests to start a new session. 40 // Called when the frame requests to start a new session.
41 // The ownership of the |callbacks| argument is transferred to the embedder. 41 // The ownership of the |callbacks| argument is transferred to the embedder.
42 virtual void startSession(const WebVector<WebString>& presentationUrls, WebP resentationConnectionClientCallbacks*) = 0; 42 virtual void startSession(const WebVector<WebURL>& presentationUrls, WebPres entationConnectionClientCallbacks*) = 0;
43 43
44 // Called when the frame requests to join an existing session. 44 // Called when the frame requests to join an existing session.
45 // The ownership of the |callbacks| argument is transferred to the embedder. 45 // The ownership of the |callbacks| argument is transferred to the embedder.
46 virtual void joinSession(const WebVector<WebString>& presentationUrls, const WebString& presentationId, WebPresentationConnectionClientCallbacks*) = 0; 46 virtual void joinSession(const WebVector<WebURL>& presentationUrls, const We bString& presentationId, WebPresentationConnectionClientCallbacks*) = 0;
47 47
48 // Called when the frame requests to send String message to an existing sess ion. 48 // Called when the frame requests to send String message to an existing sess ion.
49 49
50 virtual void sendString(const WebString& presentationUrl, const WebString& p resentationId, const WebString& message) = 0; 50 virtual void sendString(const WebURL& presentationUrl, const WebString& pres entationId, const WebString& message) = 0;
51 51
52 // Called when the frame requests to send ArrayBuffer/View data to an existi ng session. 52 // Called when the frame requests to send ArrayBuffer/View data to an existi ng session.
53 // Embedder copies the |data| and the ownership is not transferred. 53 // Embedder copies the |data| and the ownership is not transferred.
54 virtual void sendArrayBuffer(const WebString& presentationUrl, const WebStri ng& presentationId, const uint8_t* data, size_t length) = 0; 54 virtual void sendArrayBuffer(const WebURL& presentationUrl, const WebString& presentationId, const uint8_t* data, size_t length) = 0;
55 55
56 // Called when the frame requests to send Blob data to an existing session. 56 // Called when the frame requests to send Blob data to an existing session.
57 // Embedder copies the |data| and the ownership is not transferred. 57 // Embedder copies the |data| and the ownership is not transferred.
58 virtual void sendBlobData(const WebString& presentationUrl, const WebString& presentationId, const uint8_t* data, size_t length) = 0; 58 virtual void sendBlobData(const WebURL& presentationUrl, const WebString& pr esentationId, const uint8_t* data, size_t length) = 0;
59 59
60 // Called when the frame requests to close an existing session. 60 // Called when the frame requests to close an existing session.
61 virtual void closeSession(const WebString& presentationUrl, const WebString& presentationId) = 0; 61 virtual void closeSession(const WebURL& presentationUrl, const WebString& pr esentationId) = 0;
62 62
63 // Called when the frame requests to terminate an existing session. 63 // Called when the frame requests to terminate an existing session.
64 virtual void terminateSession(const WebString& presentationUrl, const WebStr ing& presentationId) = 0; 64 virtual void terminateSession(const WebURL& presentationUrl, const WebString & presentationId) = 0;
65 65
66 // Called when the frame wants to know the availability of a presentation 66 // Called when the frame wants to know the availability of a presentation
67 // display for |availabilityUrl|. The ownership of the callbacks argument 67 // display for |availabilityUrl|. The ownership of the callbacks argument
68 // is transferred to the embedder. 68 // is transferred to the embedder.
69 virtual void getAvailability(const WebString& availabilityUrl, WebPresentati onAvailabilityCallbacks*) = 0; 69 virtual void getAvailability(const WebURL& availabilityUrl, WebPresentationA vailabilityCallbacks*) = 0;
70 70
71 // Start listening to changes in presentation displays availability. The 71 // Start listening to changes in presentation displays availability. The
72 // observer will be notified in case of a change. The observer is 72 // observer will be notified in case of a change. The observer is
73 // respensible to call stopListening() before being destroyed. 73 // respensible to call stopListening() before being destroyed.
74 virtual void startListening(WebPresentationAvailabilityObserver*) = 0; 74 virtual void startListening(WebPresentationAvailabilityObserver*) = 0;
75 75
76 // Stop listening to changes in presentation displays availability. The 76 // Stop listening to changes in presentation displays availability. The
77 // observer will no longer be notified in case of a change. 77 // observer will no longer be notified in case of a change.
78 virtual void stopListening(WebPresentationAvailabilityObserver*) = 0; 78 virtual void stopListening(WebPresentationAvailabilityObserver*) = 0;
79 79
80 // Called when a defaultRequest has been set. It sends the url associated 80 // Called when a defaultRequest has been set. It sends the url associated
81 // with it for the embedder. 81 // with it for the embedder.
82 virtual void setDefaultPresentationUrls(const WebVector<WebString>&) = 0; 82 virtual void setDefaultPresentationUrls(const WebVector<WebURL>&) = 0;
83 }; 83 };
84 84
85 } // namespace blink 85 } // namespace blink
86 86
87 #endif // WebPresentationClient_h 87 #endif // WebPresentationClient_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698