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

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

Issue 1522313003: [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@master
Patch Set: Fixed some null pointer exceptions 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 status->availability_callbacks.Clear(); 339 status->availability_callbacks.Clear();
340 UpdateListeningState(status); 340 UpdateListeningState(status);
341 } 341 }
342 342
343 void PresentationDispatcher::OnDefaultSessionStarted( 343 void PresentationDispatcher::OnDefaultSessionStarted(
344 presentation::PresentationSessionInfoPtr session_info) { 344 presentation::PresentationSessionInfoPtr session_info) {
345 if (!controller_) 345 if (!controller_)
346 return; 346 return;
347 347
348 if (!session_info.is_null()) { 348 if (!session_info.is_null()) {
349 presentation_service_->ListenForSessionMessages(session_info.Clone());
349 controller_->didStartDefaultSession( 350 controller_->didStartDefaultSession(
350 new PresentationConnectionClient(session_info.Clone())); 351 new PresentationConnectionClient(session_info.Pass()));
351 presentation_service_->ListenForSessionMessages(session_info.Pass());
352 } 352 }
353 } 353 }
354 354
355 void PresentationDispatcher::OnSessionCreated( 355 void PresentationDispatcher::OnSessionCreated(
356 blink::WebPresentationConnectionClientCallbacks* callback, 356 blink::WebPresentationConnectionClientCallbacks* callback,
357 presentation::PresentationSessionInfoPtr session_info, 357 presentation::PresentationSessionInfoPtr session_info,
358 presentation::PresentationErrorPtr error) { 358 presentation::PresentationErrorPtr error) {
359 DCHECK(callback); 359 DCHECK(callback);
360 if (!error.is_null()) { 360 if (!error.is_null()) {
361 DCHECK(session_info.is_null()); 361 DCHECK(session_info.is_null());
362 callback->onError(blink::WebPresentationError( 362 callback->onError(blink::WebPresentationError(
363 GetWebPresentationErrorTypeFromMojo(error->error_type), 363 GetWebPresentationErrorTypeFromMojo(error->error_type),
364 blink::WebString::fromUTF8(error->message))); 364 blink::WebString::fromUTF8(error->message)));
365 return; 365 return;
366 } 366 }
367 367
368 DCHECK(!session_info.is_null()); 368 DCHECK(!session_info.is_null());
369 presentation_service_->ListenForSessionMessages(session_info.Clone());
369 callback->onSuccess(blink::adoptWebPtr( 370 callback->onSuccess(blink::adoptWebPtr(
370 new PresentationConnectionClient(session_info.Clone()))); 371 new PresentationConnectionClient(session_info.Pass())));
371 presentation_service_->ListenForSessionMessages(session_info.Pass());
372 } 372 }
373 373
374 void PresentationDispatcher::OnConnectionStateChanged( 374 void PresentationDispatcher::OnConnectionStateChanged(
375 presentation::PresentationSessionInfoPtr connection, 375 presentation::PresentationSessionInfoPtr connection,
376 presentation::PresentationConnectionState state) { 376 presentation::PresentationConnectionState state) {
377 if (!controller_) 377 if (!controller_)
378 return; 378 return;
379 379
380 DCHECK(!connection.is_null()); 380 DCHECK(!connection.is_null());
381 controller_->didChangeSessionState( 381 controller_->didChangeSessionState(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( 498 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus(
499 const std::string& availability_url) 499 const std::string& availability_url)
500 : url(availability_url), 500 : url(availability_url),
501 last_known_availability(false), 501 last_known_availability(false),
502 listening_state(ListeningState::INACTIVE) {} 502 listening_state(ListeningState::INACTIVE) {}
503 503
504 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { 504 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() {
505 } 505 }
506 506
507 } // namespace content 507 } // 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