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 CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <queue> | 13 #include <queue> |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/id_map.h" | 16 #include "base/id_map.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/public/renderer/render_frame_observer.h" | 19 #include "content/public/renderer/render_frame_observer.h" |
20 #include "mojo/public/cpp/bindings/binding.h" | 20 #include "mojo/public/cpp/bindings/binding.h" |
21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" | 21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nClient.h" |
22 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" | 22 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m
ojom.h" |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
25 class WebPresentationAvailabilityObserver; | 25 class WebPresentationAvailabilityObserver; |
26 class WebString; | 26 class WebString; |
| 27 template <typename T> class WebVector; |
27 } // namespace blink | 28 } // namespace blink |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 | 31 |
31 // PresentationDispatcher is a delegate for Presentation API messages used by | 32 // PresentationDispatcher is a delegate for Presentation API messages used by |
32 // Blink. It forwards the calls to the Mojo PresentationService. | 33 // Blink. It forwards the calls to the Mojo PresentationService. |
33 class CONTENT_EXPORT PresentationDispatcher | 34 class CONTENT_EXPORT PresentationDispatcher |
34 : public RenderFrameObserver, | 35 : public RenderFrameObserver, |
35 public NON_EXPORTED_BASE(blink::WebPresentationClient), | 36 public NON_EXPORTED_BASE(blink::WebPresentationClient), |
36 public NON_EXPORTED_BASE(blink::mojom::PresentationServiceClient) { | 37 public NON_EXPORTED_BASE(blink::mojom::PresentationServiceClient) { |
(...skipping 18 matching lines...) Expand all Loading... |
55 static SendMessageRequest* CreateSendBinaryMessageRequest( | 56 static SendMessageRequest* CreateSendBinaryMessageRequest( |
56 const blink::WebString& presentationUrl, | 57 const blink::WebString& presentationUrl, |
57 const blink::WebString& presentationId, | 58 const blink::WebString& presentationId, |
58 blink::mojom::PresentationMessageType type, | 59 blink::mojom::PresentationMessageType type, |
59 const uint8_t* data, | 60 const uint8_t* data, |
60 size_t length); | 61 size_t length); |
61 | 62 |
62 // WebPresentationClient implementation. | 63 // WebPresentationClient implementation. |
63 void setController(blink::WebPresentationController* controller) override; | 64 void setController(blink::WebPresentationController* controller) override; |
64 void startSession( | 65 void startSession( |
65 const blink::WebString& presentationUrl, | 66 const blink::WebVector<blink::WebString>& presentationUrls, |
66 blink::WebPresentationConnectionClientCallbacks* callback) override; | 67 blink::WebPresentationConnectionClientCallbacks* callback) override; |
67 void joinSession( | 68 void joinSession( |
68 const blink::WebString& presentationUrl, | 69 const blink::WebVector<blink::WebString>& presentationUrls, |
69 const blink::WebString& presentationId, | 70 const blink::WebString& presentationId, |
70 blink::WebPresentationConnectionClientCallbacks* callback) override; | 71 blink::WebPresentationConnectionClientCallbacks* callback) override; |
71 void sendString(const blink::WebString& presentationUrl, | 72 void sendString(const blink::WebString& presentationUrl, |
72 const blink::WebString& presentationId, | 73 const blink::WebString& presentationId, |
73 const blink::WebString& message) override; | 74 const blink::WebString& message) override; |
74 void sendArrayBuffer(const blink::WebString& presentationUrl, | 75 void sendArrayBuffer(const blink::WebString& presentationUrl, |
75 const blink::WebString& presentationId, | 76 const blink::WebString& presentationId, |
76 const uint8_t* data, | 77 const uint8_t* data, |
77 size_t length) override; | 78 size_t length) override; |
78 void sendBlobData(const blink::WebString& presentationUrl, | 79 void sendBlobData(const blink::WebString& presentationUrl, |
79 const blink::WebString& presentationId, | 80 const blink::WebString& presentationId, |
80 const uint8_t* data, | 81 const uint8_t* data, |
81 size_t length) override; | 82 size_t length) override; |
82 void closeSession(const blink::WebString& presentationUrl, | 83 void closeSession(const blink::WebString& presentationUrl, |
83 const blink::WebString& presentationId) override; | 84 const blink::WebString& presentationId) override; |
84 void terminateSession(const blink::WebString& presentationUrl, | 85 void terminateSession(const blink::WebString& presentationUrl, |
85 const blink::WebString& presentationId) override; | 86 const blink::WebString& presentationId) override; |
86 void getAvailability( | 87 void getAvailability( |
87 const blink::WebString& availabilityUrl, | 88 const blink::WebVector<blink::WebString>& availabilityUrls, |
88 blink::WebPresentationAvailabilityCallbacks* callbacks) override; | 89 blink::WebPresentationAvailabilityCallbacks* callbacks) override; |
89 void startListening(blink::WebPresentationAvailabilityObserver*) override; | 90 void startListening(blink::WebPresentationAvailabilityObserver*) override; |
90 void stopListening(blink::WebPresentationAvailabilityObserver*) override; | 91 void stopListening(blink::WebPresentationAvailabilityObserver*) override; |
91 void setDefaultPresentationUrl(const blink::WebString& url) override; | 92 void setDefaultPresentationUrls( |
| 93 const blink::WebVector<blink::WebString>& urls) override; |
92 | 94 |
93 // RenderFrameObserver implementation. | 95 // RenderFrameObserver implementation. |
94 void DidCommitProvisionalLoad( | 96 void DidCommitProvisionalLoad( |
95 bool is_new_navigation, | 97 bool is_new_navigation, |
96 bool is_same_page_navigation) override; | 98 bool is_same_page_navigation) override; |
97 void OnDestruct() override; | 99 void OnDestruct() override; |
98 | 100 |
99 // blink::mojom::PresentationServiceClient | 101 // blink::mojom::PresentationServiceClient |
100 void OnScreenAvailabilityNotSupported(const mojo::String& url) override; | 102 void OnScreenAvailabilityNotSupported(const mojo::String& url) override; |
101 void OnScreenAvailabilityUpdated(const mojo::String& url, | 103 void OnScreenAvailabilityUpdated(const mojo::String& url, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Updates the listening state of availability for |status| and notifies the | 169 // Updates the listening state of availability for |status| and notifies the |
168 // client. | 170 // client. |
169 void UpdateListeningState(AvailabilityStatus* status); | 171 void UpdateListeningState(AvailabilityStatus* status); |
170 | 172 |
171 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); | 173 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); |
172 }; | 174 }; |
173 | 175 |
174 } // namespace content | 176 } // namespace content |
175 | 177 |
176 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ | 178 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ |
OLD | NEW |