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

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

Issue 1118103002: Implements ListenForSessionMessages in PresentationServiceImpl; uses Swap to avoid copying large da… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 10 matching lines...) Expand all
21 #include "content/public/browser/navigation_details.h" 21 #include "content/public/browser/navigation_details.h"
22 #include "content/public/browser/presentation_screen_availability_listener.h" 22 #include "content/public/browser/presentation_screen_availability_listener.h"
23 #include "content/public/browser/presentation_service_delegate.h" 23 #include "content/public/browser/presentation_service_delegate.h"
24 #include "content/public/browser/web_contents_observer.h" 24 #include "content/public/browser/web_contents_observer.h"
25 #include "content/public/common/frame_navigate_params.h" 25 #include "content/public/common/frame_navigate_params.h"
26 26
27 namespace content { 27 namespace content {
28 28
29 struct FrameNavigateParams; 29 struct FrameNavigateParams;
30 struct LoadCommittedDetails; 30 struct LoadCommittedDetails;
31 struct PresentationSessionMessage;
31 class RenderFrameHost; 32 class RenderFrameHost;
32 33
33 // Implementation of Mojo PresentationService. 34 // Implementation of Mojo PresentationService.
34 // It handles Presentation API requests coming from Blink / renderer process 35 // It handles Presentation API requests coming from Blink / renderer process
35 // and delegates the requests to the embedder's media router via 36 // and delegates the requests to the embedder's media router via
36 // PresentationServiceDelegate. 37 // PresentationServiceDelegate.
37 // An instance of this class tied to a RenderFrameHost and listens to events 38 // An instance of this class tied to a RenderFrameHost and listens to events
38 // related to the RFH via implementing WebContentsObserver. 39 // related to the RFH via implementing WebContentsObserver.
39 // This class is instantiated on-demand via Mojo's ConnectToRemoteService 40 // This class is instantiated on-demand via Mojo's ConnectToRemoteService
40 // from the renderer when the first presentation API request is handled. 41 // from the renderer when the first presentation API request is handled.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 bool is_start_session, 261 bool is_start_session,
261 int request_session_id, 262 int request_session_id,
262 const PresentationError& error); 263 const PresentationError& error);
263 264
264 // Requests delegate to start a session. 265 // Requests delegate to start a session.
265 void DoStartSession( 266 void DoStartSession(
266 const std::string& presentation_url, 267 const std::string& presentation_url,
267 const std::string& presentation_id, 268 const std::string& presentation_id,
268 const NewSessionMojoCallback& callback); 269 const NewSessionMojoCallback& callback);
269 270
271 void OnSessionMessages(
272 const SessionMessagesCallback& callback,
273 scoped_ptr<ScopedVector<PresentationSessionMessage>> messages);
274
275 static presentation::SessionMessagePtr ToMojoSessionMessage(
276 content::PresentationSessionMessage* input);
277
270 // Removes the head of the queue (which represents the request that has just 278 // Removes the head of the queue (which represents the request that has just
271 // been processed). 279 // been processed).
272 // Checks if there are any queued StartSession requests and if so, executes 280 // Checks if there are any queued StartSession requests and if so, executes
273 // the first one in the queue. 281 // the first one in the queue.
274 void HandleQueuedStartSessionRequests(); 282 void HandleQueuedStartSessionRequests();
275 283
276 // Associates |callback| with a unique request ID and stores it in a map. 284 // Associates |callback| with a unique request ID and stores it in a map.
277 int RegisterNewSessionCallback( 285 int RegisterNewSessionCallback(
278 const NewSessionMojoCallback& callback); 286 const NewSessionMojoCallback& callback);
279 287
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 332
325 // NOTE: Weak pointers must be invalidated before all other member variables. 333 // NOTE: Weak pointers must be invalidated before all other member variables.
326 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_; 334 base::WeakPtrFactory<PresentationServiceImpl> weak_factory_;
327 335
328 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl); 336 DISALLOW_COPY_AND_ASSIGN(PresentationServiceImpl);
329 }; 337 };
330 338
331 } // namespace content 339 } // namespace content
332 340
333 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_ 341 #endif // CONTENT_BROWSER_PRESENTATION_PRESENTATION_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698