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

Side by Side Diff: content/browser/presentation/presentation_service_impl.h

Issue 1037483003: [PresentationAPI] Implementing send() from WebPresentationClient to the PresentationService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved presentation_message.h/.cc to content/public/browser/ Created 5 years, 7 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_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 6 #define CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 using ScreenAvailabilityMojoCallback = 57 using ScreenAvailabilityMojoCallback =
58 mojo::Callback<void(mojo::String, bool)>; 58 mojo::Callback<void(mojo::String, bool)>;
59 using NewSessionMojoCallback = 59 using NewSessionMojoCallback =
60 mojo::Callback<void(presentation::PresentationSessionInfoPtr, 60 mojo::Callback<void(presentation::PresentationSessionInfoPtr,
61 presentation::PresentationErrorPtr)>; 61 presentation::PresentationErrorPtr)>;
62 using DefaultSessionMojoCallback = 62 using DefaultSessionMojoCallback =
63 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>; 63 mojo::Callback<void(presentation::PresentationSessionInfoPtr)>;
64 using SessionStateCallback = 64 using SessionStateCallback =
65 mojo::Callback<void(presentation::PresentationSessionInfoPtr, 65 mojo::Callback<void(presentation::PresentationSessionInfoPtr,
66 presentation::PresentationSessionState)>; 66 presentation::PresentationSessionState)>;
67 using SendMessageMojoCallback = mojo::Callback<void(bool)>;
67 68
68 // A helper data class used by PresentationServiceImpl to do bookkeeping 69 // A helper data class used by PresentationServiceImpl to do bookkeeping
69 // of currently registered screen availability listeners. 70 // of currently registered screen availability listeners.
70 // An instance of this class is a simple state machine that waits for both 71 // An instance of this class is a simple state machine that waits for both
71 // the available bit and the Mojo callback to become available. 72 // the available bit and the Mojo callback to become available.
72 // Once this happens, the Mojo callback will be invoked with the available 73 // Once this happens, the Mojo callback will be invoked with the available
73 // bit, and the state machine will reset. 74 // bit, and the state machine will reset.
74 // The available bit is obtained from the embedder's media router. 75 // The available bit is obtained from the embedder's media router.
75 // The callback is obtained from the renderer via PresentationServiceImpl's 76 // The callback is obtained from the renderer via PresentationServiceImpl's
76 // ListenForScreenAvailability(). 77 // ListenForScreenAvailability().
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void ListenForDefaultSessionStart( 196 void ListenForDefaultSessionStart(
196 const DefaultSessionMojoCallback& callback) override; 197 const DefaultSessionMojoCallback& callback) override;
197 void StartSession( 198 void StartSession(
198 const mojo::String& presentation_url, 199 const mojo::String& presentation_url,
199 const mojo::String& presentation_id, 200 const mojo::String& presentation_id,
200 const NewSessionMojoCallback& callback) override; 201 const NewSessionMojoCallback& callback) override;
201 void JoinSession( 202 void JoinSession(
202 const mojo::String& presentation_url, 203 const mojo::String& presentation_url,
203 const mojo::String& presentation_id, 204 const mojo::String& presentation_id,
204 const NewSessionMojoCallback& callback) override; 205 const NewSessionMojoCallback& callback) override;
206 void SendMessage(
207 presentation::SessionMessagePtr message_request,
208 const SendMessageMojoCallback& callback) override;
205 void CloseSession( 209 void CloseSession(
206 const mojo::String& presentation_url, 210 const mojo::String& presentation_url,
207 const mojo::String& presentation_id) override; 211 const mojo::String& presentation_id) override;
208 void ListenForSessionStateChange( 212 void ListenForSessionStateChange(
209 const SessionStateCallback& callback) override; 213 const SessionStateCallback& callback) override;
210 214
211 // Creates a binding between this object and |request|. 215 // Creates a binding between this object and |request|.
212 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request); 216 void Bind(mojo::InterfaceRequest<presentation::PresentationService> request);
213 217
214 // mojo::ErrorHandler override. 218 // mojo::ErrorHandler override.
(...skipping 23 matching lines...) Expand all
238 // Sets |default_presentation_url_| to |presentation_url| and informs the 242 // Sets |default_presentation_url_| to |presentation_url| and informs the
239 // delegate of new default presentation URL and ID. 243 // delegate of new default presentation URL and ID.
240 void DoSetDefaultPresentationUrl( 244 void DoSetDefaultPresentationUrl(
241 const std::string& presentation_url, 245 const std::string& presentation_url,
242 const std::string& presentation_id); 246 const std::string& presentation_id);
243 247
244 // Removes all listeners and resets default presentation URL on this instance 248 // Removes all listeners and resets default presentation URL on this instance
245 // and informs the PresentationServiceDelegate of such. 249 // and informs the PresentationServiceDelegate of such.
246 void Reset(); 250 void Reset();
247 251
248 // These two functions are bound as base::Callbacks and passed to 252 // These functions are bound as base::Callbacks and passed to
249 // embedder's implementation of PresentationServiceDelegate for later 253 // embedder's implementation of PresentationServiceDelegate for later
250 // invocation. 254 // invocation.
251 void OnStartOrJoinSessionSucceeded( 255 void OnStartOrJoinSessionSucceeded(
252 bool is_start_session, 256 bool is_start_session,
253 int request_session_id, 257 int request_session_id,
254 const PresentationSessionInfo& session_info); 258 const PresentationSessionInfo& session_info);
255 void OnStartOrJoinSessionError( 259 void OnStartOrJoinSessionError(
256 bool is_start_session, 260 bool is_start_session,
257 int request_session_id, 261 int request_session_id,
258 const PresentationError& error); 262 const PresentationError& error);
263 void OnSendMessageCallback();
259 264
260 // Requests delegate to start a session. 265 // Requests delegate to start a session.
261 void DoStartSession( 266 void DoStartSession(
262 const std::string& presentation_url, 267 const std::string& presentation_url,
263 const std::string& presentation_id, 268 const std::string& presentation_id,
264 const NewSessionMojoCallback& callback); 269 const NewSessionMojoCallback& callback);
265 270
266 // Removes the head of the queue (which represents the request that has just 271 // Removes the head of the queue (which represents the request that has just
267 // been processed). 272 // been processed).
268 // Checks if there are any queued StartSession requests and if so, executes 273 // Checks if there are any queued StartSession requests and if so, executes
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // The binding is removed when binding_ is cleared or goes out of scope. 319 // The binding is removed when binding_ is cleared or goes out of scope.
315 scoped_ptr<mojo::Binding<presentation::PresentationService>> binding_; 320 scoped_ptr<mojo::Binding<presentation::PresentationService>> binding_;
316 321
317 // ID of the RenderFrameHost this object is associated with. 322 // ID of the RenderFrameHost this object is associated with.
318 int render_process_id_; 323 int render_process_id_;
319 int render_frame_id_; 324 int render_frame_id_;
320 325
321 // NOTE: Weak pointers must be invalidated before all other member variables. 326 // NOTE: Weak pointers must be invalidated before all other member variables.
322 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; 327 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_;
323 328
329 // There could be one send message request at a time.
330 scoped_ptr<SendMessageMojoCallback> send_message_cb_ptr_;
331
324 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); 332 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl);
325 }; 333 };
326 334
327 } // namespace content 335 } // namespace content
328 336
329 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 337 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698