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

Side by Side Diff: content/renderer/presentation/presentation_dispatcher.h

Issue 2613153003: [Presentation API] Replaces type converters with typemaps (Closed)
Patch Set: Extend presentation ID max length to 64. Created 3 years, 10 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 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 #include <set> 14 #include <set>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
19 #include "base/id_map.h" 19 #include "base/id_map.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
22 #include "content/public/common/presentation_session.h"
22 #include "content/public/renderer/render_frame_observer.h" 23 #include "content/public/renderer/render_frame_observer.h"
23 #include "mojo/public/cpp/bindings/binding.h" 24 #include "mojo/public/cpp/bindings/binding.h"
24 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h" 25 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nClient.h"
25 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h" 26 #include "third_party/WebKit/public/platform/modules/presentation/presentation.m ojom.h"
26 #include "url/gurl.h" 27 #include "url/gurl.h"
27 28
28 namespace blink { 29 namespace blink {
29 class WebPresentationAvailabilityObserver; 30 class WebPresentationAvailabilityObserver;
30 class WebPresentationReceiver; 31 class WebPresentationReceiver;
31 class WebString; 32 class WebString;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData); 64 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData);
64 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession); 65 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession);
65 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession); 66 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession);
66 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, 67 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest,
67 TestListenForScreenAvailability); 68 TestListenForScreenAvailability);
68 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, 69 FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest,
69 TestSetDefaultPresentationUrls); 70 TestSetDefaultPresentationUrls);
70 71
71 struct SendMessageRequest { 72 struct SendMessageRequest {
72 SendMessageRequest( 73 SendMessageRequest(
73 blink::mojom::PresentationSessionInfoPtr session_info, 74 const PresentationSessionInfo& session_info,
74 blink::mojom::ConnectionMessagePtr message, 75 blink::mojom::ConnectionMessagePtr message,
75 const blink::WebPresentationConnectionProxy* connection_proxy); 76 const blink::WebPresentationConnectionProxy* connection_proxy);
77
76 ~SendMessageRequest(); 78 ~SendMessageRequest();
77 79
78 blink::mojom::PresentationSessionInfoPtr session_info; 80 PresentationSessionInfo session_info;
79 blink::mojom::ConnectionMessagePtr message; 81 blink::mojom::ConnectionMessagePtr message;
80 // Proxy of Blink connection object |connection| calling connection.send(). 82 // Proxy of Blink connection object |connection| calling connection.send().
81 // It does not take ownership of proxy object. Proxy object is owned by 83 // It does not take ownership of proxy object. Proxy object is owned by
82 // Blink connection. Blink connection is destroyed after 84 // Blink connection. Blink connection is destroyed after
83 // PresentationDispatcher so |connection_proxy| should always be valid. 85 // PresentationDispatcher so |connection_proxy| should always be valid.
84 const blink::WebPresentationConnectionProxy* connection_proxy; 86 const blink::WebPresentationConnectionProxy* connection_proxy;
85 }; 87 };
86 88
87 static SendMessageRequest* CreateSendTextMessageRequest( 89 static SendMessageRequest* CreateSendTextMessageRequest(
88 const blink::WebURL& presentationUrl, 90 const blink::WebURL& presentationUrl,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 141
140 // RenderFrameObserver implementation. 142 // RenderFrameObserver implementation.
141 void DidCommitProvisionalLoad( 143 void DidCommitProvisionalLoad(
142 bool is_new_navigation, 144 bool is_new_navigation,
143 bool is_same_page_navigation) override; 145 bool is_same_page_navigation) override;
144 void OnDestruct() override; 146 void OnDestruct() override;
145 147
146 // blink::mojom::PresentationServiceClient 148 // blink::mojom::PresentationServiceClient
147 void OnScreenAvailabilityNotSupported(const GURL& url) override; 149 void OnScreenAvailabilityNotSupported(const GURL& url) override;
148 void OnScreenAvailabilityUpdated(const GURL& url, bool available) override; 150 void OnScreenAvailabilityUpdated(const GURL& url, bool available) override;
149 void OnConnectionStateChanged( 151 void OnConnectionStateChanged(const PresentationSessionInfo& session_info,
150 blink::mojom::PresentationSessionInfoPtr session_info, 152 PresentationConnectionState state) override;
151 blink::mojom::PresentationConnectionState state) override; 153 void OnConnectionClosed(const PresentationSessionInfo& session_info,
152 void OnConnectionClosed( 154 PresentationConnectionCloseReason reason,
153 blink::mojom::PresentationSessionInfoPtr session_info, 155 const std::string& message) override;
154 blink::mojom::PresentationConnectionCloseReason reason,
155 const std::string& message) override;
156 void OnConnectionMessagesReceived( 156 void OnConnectionMessagesReceived(
157 blink::mojom::PresentationSessionInfoPtr session_info, 157 const PresentationSessionInfo& session_info,
158 std::vector<blink::mojom::ConnectionMessagePtr> messages) override; 158 std::vector<blink::mojom::ConnectionMessagePtr> messages) override;
159 void OnDefaultSessionStarted( 159 void OnDefaultSessionStarted(
160 blink::mojom::PresentationSessionInfoPtr session_info) override; 160 const PresentationSessionInfo& session_info) override;
161 161
162 void OnSessionCreated( 162 void OnSessionCreated(
163 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback, 163 std::unique_ptr<blink::WebPresentationConnectionCallbacks> callback,
164 blink::mojom::PresentationSessionInfoPtr session_info, 164 const base::Optional<PresentationSessionInfo>& session_info,
165 blink::mojom::PresentationErrorPtr error); 165 const base::Optional<PresentationError>& error);
166 void OnReceiverConnectionAvailable( 166 void OnReceiverConnectionAvailable(
167 blink::mojom::PresentationSessionInfoPtr, 167 const PresentationSessionInfo& session_info,
168 blink::mojom::PresentationConnectionPtr, 168 blink::mojom::PresentationConnectionPtr /*connection*/,
169 blink::mojom::PresentationConnectionRequest) override; 169 blink::mojom::PresentationConnectionRequest /*connection_request*/)
170 override;
170 171
171 // Call to PresentationService to send the message in |request|. 172 // Call to PresentationService to send the message in |request|.
172 // |session_info| and |message| of |reuqest| will be consumed. 173 // |session_info| and |message| of |reuqest| will be consumed.
173 // |HandleSendMessageRequests| will be invoked after the send is attempted. 174 // |HandleSendMessageRequests| will be invoked after the send is attempted.
174 void DoSendMessage(SendMessageRequest* request); 175 void DoSendMessage(SendMessageRequest* request);
175 void HandleSendMessageRequests(bool success); 176 void HandleSendMessageRequests(bool success);
176 177
177 virtual void ConnectToPresentationServiceIfNeeded(); 178 virtual void ConnectToPresentationServiceIfNeeded();
178 179
179 void UpdateListeningState(); 180 void UpdateListeningState();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // Returns UNKNOWN if all urls in |urls| have screen availability 263 // Returns UNKNOWN if all urls in |urls| have screen availability
263 // UNKNOWN. 264 // UNKNOWN.
264 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const; 265 ScreenAvailability GetScreenAvailability(const std::vector<GURL>& urls) const;
265 266
266 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); 267 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher);
267 }; 268 };
268 269
269 } // namespace content 270 } // namespace content
270 271
271 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ 272 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698