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

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

Issue 2471573005: [Presentation API] (5th) (1-UA) integrate controller and receiver side for 1-UA messaging (Closed)
Patch Set: rebase Created 4 years, 1 month 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
(...skipping 15 matching lines...) Expand all
26 class WebPresentationAvailabilityObserver; 26 class WebPresentationAvailabilityObserver;
27 class WebPresentationReceiver; 27 class WebPresentationReceiver;
28 class WebString; 28 class WebString;
29 class WebURL; 29 class WebURL;
30 template <typename T> 30 template <typename T>
31 class WebVector; 31 class WebVector;
32 } // namespace blink 32 } // namespace blink
33 33
34 namespace content { 34 namespace content {
35 35
36 class PresentationConnectionProxy;
37
36 // PresentationDispatcher is a delegate for Presentation API messages used by 38 // PresentationDispatcher is a delegate for Presentation API messages used by
37 // Blink. It forwards the calls to the Mojo PresentationService. 39 // Blink. It forwards the calls to the Mojo PresentationService.
38 class CONTENT_EXPORT PresentationDispatcher 40 class CONTENT_EXPORT PresentationDispatcher
39 : public RenderFrameObserver, 41 : public RenderFrameObserver,
40 public NON_EXPORTED_BASE(blink::WebPresentationClient), 42 public NON_EXPORTED_BASE(blink::WebPresentationClient),
41 public NON_EXPORTED_BASE(blink::mojom::PresentationServiceClient) { 43 public NON_EXPORTED_BASE(blink::mojom::PresentationServiceClient) {
42 public: 44 public:
43 explicit PresentationDispatcher(RenderFrame* render_frame); 45 explicit PresentationDispatcher(RenderFrame* render_frame);
44 ~PresentationDispatcher() override; 46 ~PresentationDispatcher() override;
45 47
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 blink::mojom::PresentationSessionInfoPtr session_info, 120 blink::mojom::PresentationSessionInfoPtr session_info,
119 std::vector<blink::mojom::SessionMessagePtr> messages) override; 121 std::vector<blink::mojom::SessionMessagePtr> messages) override;
120 void OnDefaultSessionStarted( 122 void OnDefaultSessionStarted(
121 blink::mojom::PresentationSessionInfoPtr session_info) override; 123 blink::mojom::PresentationSessionInfoPtr session_info) override;
122 124
123 void OnSessionCreated( 125 void OnSessionCreated(
124 blink::WebPresentationConnectionClientCallbacks* callback, 126 blink::WebPresentationConnectionClientCallbacks* callback,
125 blink::mojom::PresentationSessionInfoPtr session_info, 127 blink::mojom::PresentationSessionInfoPtr session_info,
126 blink::mojom::PresentationErrorPtr error); 128 blink::mojom::PresentationErrorPtr error);
127 void OnReceiverConnectionAvailable( 129 void OnReceiverConnectionAvailable(
128 blink::mojom::PresentationSessionInfoPtr) override; 130 blink::mojom::PresentationSessionInfoPtr,
131 blink::mojom::PresentationConnectionPtr) override;
129 132
130 // Call to PresentationService to send the message in |request|. 133 // Call to PresentationService to send the message in |request|.
131 // |session_info| and |message| of |reuqest| will be consumed. 134 // |session_info| and |message| of |reuqest| will be consumed.
132 // |HandleSendMessageRequests| will be invoked after the send is attempted. 135 // |HandleSendMessageRequests| will be invoked after the send is attempted.
133 void DoSendMessage(SendMessageRequest* request); 136 void DoSendMessage(SendMessageRequest* request);
134 void HandleSendMessageRequests(bool success); 137 void HandleSendMessageRequests(bool success);
135 138
136 void ConnectToPresentationServiceIfNeeded(); 139 void ConnectToPresentationServiceIfNeeded();
137 140
138 void UpdateListeningState(); 141 void UpdateListeningState();
142 std::unique_ptr<PresentationConnectionProxy>
143 CreateAndSetControllerConnectionProxy(
144 blink::mojom::PresentationSessionInfoPtr session_info);
139 145
140 // Used as a weak reference. Can be null since lifetime is bound to the frame. 146 // Used as a weak reference. Can be null since lifetime is bound to the frame.
141 blink::WebPresentationController* controller_; 147 blink::WebPresentationController* controller_;
142 blink::WebPresentationReceiver* receiver_; 148 blink::WebPresentationReceiver* receiver_;
143 blink::mojom::PresentationServicePtr presentation_service_; 149 blink::mojom::PresentationServicePtr presentation_service_;
144 mojo::Binding<blink::mojom::PresentationServiceClient> binding_; 150 mojo::Binding<blink::mojom::PresentationServiceClient> binding_;
145 151
146 // Message requests are queued here and only one message at a time is sent 152 // Message requests are queued here and only one message at a time is sent
147 // over mojo channel. 153 // over mojo channel.
148 using MessageRequestQueue = std::queue<std::unique_ptr<SendMessageRequest>>; 154 using MessageRequestQueue = std::queue<std::unique_ptr<SendMessageRequest>>;
(...skipping 29 matching lines...) Expand all
178 // Updates the listening state of availability for |status| and notifies the 184 // Updates the listening state of availability for |status| and notifies the
179 // client. 185 // client.
180 void UpdateListeningState(AvailabilityStatus* status); 186 void UpdateListeningState(AvailabilityStatus* status);
181 187
182 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher); 188 DISALLOW_COPY_AND_ASSIGN(PresentationDispatcher);
183 }; 189 };
184 190
185 } // namespace content 191 } // namespace content
186 192
187 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_ 193 #endif // CONTENT_RENDERER_PRESENTATION_PRESENTATION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698