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

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

Issue 1538493002: [Cast,Android,Presentation API] Send messages back to the right clients, listen for messages sooner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 years 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/renderer/presentation/presentation_dispatcher.h" 5 #include "content/renderer/presentation/presentation_dispatcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 status->availability_callbacks.Clear(); 331 status->availability_callbacks.Clear();
332 UpdateListeningState(status); 332 UpdateListeningState(status);
333 } 333 }
334 334
335 void PresentationDispatcher::OnDefaultSessionStarted( 335 void PresentationDispatcher::OnDefaultSessionStarted(
336 presentation::PresentationSessionInfoPtr session_info) { 336 presentation::PresentationSessionInfoPtr session_info) {
337 if (!controller_) 337 if (!controller_)
338 return; 338 return;
339 339
340 if (!session_info.is_null()) { 340 if (!session_info.is_null()) {
341 presentation_service_->ListenForSessionMessages(session_info.Clone());
341 controller_->didStartDefaultSession( 342 controller_->didStartDefaultSession(
342 new PresentationConnectionClient(session_info.Clone())); 343 new PresentationConnectionClient(session_info.Pass()));
343 presentation_service_->ListenForSessionMessages(session_info.Pass());
344 } 344 }
345 } 345 }
346 346
347 void PresentationDispatcher::OnSessionCreated( 347 void PresentationDispatcher::OnSessionCreated(
348 blink::WebPresentationConnectionClientCallbacks* callback, 348 blink::WebPresentationConnectionClientCallbacks* callback,
349 presentation::PresentationSessionInfoPtr session_info, 349 presentation::PresentationSessionInfoPtr session_info,
350 presentation::PresentationErrorPtr error) { 350 presentation::PresentationErrorPtr error) {
351 DCHECK(callback); 351 DCHECK(callback);
352 if (!error.is_null()) { 352 if (!error.is_null()) {
353 DCHECK(session_info.is_null()); 353 DCHECK(session_info.is_null());
354 callback->onError(blink::WebPresentationError( 354 callback->onError(blink::WebPresentationError(
355 GetWebPresentationErrorTypeFromMojo(error->error_type), 355 GetWebPresentationErrorTypeFromMojo(error->error_type),
356 blink::WebString::fromUTF8(error->message))); 356 blink::WebString::fromUTF8(error->message)));
357 return; 357 return;
358 } 358 }
359 359
360 DCHECK(!session_info.is_null()); 360 DCHECK(!session_info.is_null());
361 presentation_service_->ListenForSessionMessages(session_info.Clone());
361 callback->onSuccess(blink::adoptWebPtr( 362 callback->onSuccess(blink::adoptWebPtr(
362 new PresentationConnectionClient(session_info.Clone()))); 363 new PresentationConnectionClient(session_info.Pass())));
363 presentation_service_->ListenForSessionMessages(session_info.Pass());
364 } 364 }
365 365
366 void PresentationDispatcher::OnSessionStateChanged( 366 void PresentationDispatcher::OnSessionStateChanged(
367 presentation::PresentationSessionInfoPtr session_info, 367 presentation::PresentationSessionInfoPtr session_info,
368 presentation::PresentationConnectionState session_state) { 368 presentation::PresentationConnectionState session_state) {
369 if (!controller_) 369 if (!controller_)
370 return; 370 return;
371 371
372 DCHECK(!session_info.is_null()); 372 DCHECK(!session_info.is_null());
373 controller_->didChangeSessionState( 373 controller_->didChangeSessionState(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( 492 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus(
493 const std::string& availability_url) 493 const std::string& availability_url)
494 : url(availability_url), 494 : url(availability_url),
495 last_known_availability(false), 495 last_known_availability(false),
496 listening_state(ListeningState::INACTIVE) {} 496 listening_state(ListeningState::INACTIVE) {}
497 497
498 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { 498 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() {
499 } 499 }
500 500
501 } // namespace content 501 } // namespace content
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698