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

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

Issue 1406013003: [Presentation API / Media Router] Clean up default pres URL logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile again Created 5 years, 2 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 #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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 status->availability_callbacks.Clear(); 329 status->availability_callbacks.Clear();
330 UpdateListeningState(status); 330 UpdateListeningState(status);
331 } 331 }
332 332
333 void PresentationDispatcher::OnDefaultSessionStarted( 333 void PresentationDispatcher::OnDefaultSessionStarted(
334 presentation::PresentationSessionInfoPtr session_info) { 334 presentation::PresentationSessionInfoPtr session_info) {
335 if (!controller_) 335 if (!controller_)
336 return; 336 return;
337 337
338 // Reset the callback to get the next event.
339 presentation_service_->ListenForDefaultSessionStart(base::Bind(
340 &PresentationDispatcher::OnDefaultSessionStarted,
341 base::Unretained(this)));
342
343 if (!session_info.is_null()) { 338 if (!session_info.is_null()) {
344 controller_->didStartDefaultSession( 339 controller_->didStartDefaultSession(
345 new PresentationConnectionClient(session_info.Clone())); 340 new PresentationConnectionClient(session_info.Clone()));
346 presentation_service_->ListenForSessionMessages(session_info.Pass()); 341 presentation_service_->ListenForSessionMessages(session_info.Pass());
347 } 342 }
348 } 343 }
349 344
350 void PresentationDispatcher::OnSessionCreated( 345 void PresentationDispatcher::OnSessionCreated(
351 blink::WebPresentationConnectionClientCallbacks* callback, 346 blink::WebPresentationConnectionClientCallbacks* callback,
352 presentation::PresentationSessionInfoPtr session_info, 347 presentation::PresentationSessionInfoPtr session_info,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() { 412 void PresentationDispatcher::ConnectToPresentationServiceIfNeeded() {
418 if (presentation_service_.get()) 413 if (presentation_service_.get())
419 return; 414 return;
420 415
421 render_frame()->GetServiceRegistry()->ConnectToRemoteService( 416 render_frame()->GetServiceRegistry()->ConnectToRemoteService(
422 mojo::GetProxy(&presentation_service_)); 417 mojo::GetProxy(&presentation_service_));
423 presentation::PresentationServiceClientPtr client_ptr; 418 presentation::PresentationServiceClientPtr client_ptr;
424 binding_.Bind(GetProxy(&client_ptr)); 419 binding_.Bind(GetProxy(&client_ptr));
425 presentation_service_->SetClient(client_ptr.Pass()); 420 presentation_service_->SetClient(client_ptr.Pass());
426 421
427 presentation_service_->ListenForDefaultSessionStart(base::Bind(
428 &PresentationDispatcher::OnDefaultSessionStarted,
429 base::Unretained(this)));
430 presentation_service_->ListenForSessionStateChange(); 422 presentation_service_->ListenForSessionStateChange();
431 } 423 }
432 424
433 void PresentationDispatcher::UpdateListeningState(AvailabilityStatus* status) { 425 void PresentationDispatcher::UpdateListeningState(AvailabilityStatus* status) {
434 bool should_listen = !status->availability_callbacks.IsEmpty() || 426 bool should_listen = !status->availability_callbacks.IsEmpty() ||
435 !status->availability_observers.empty(); 427 !status->availability_observers.empty();
436 bool is_listening = status->listening_state != ListeningState::INACTIVE; 428 bool is_listening = status->listening_state != ListeningState::INACTIVE;
437 429
438 if (should_listen == is_listening) 430 if (should_listen == is_listening)
439 return; 431 return;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( 490 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus(
499 const std::string& availability_url) 491 const std::string& availability_url)
500 : url(availability_url), 492 : url(availability_url),
501 last_known_availability(false), 493 last_known_availability(false),
502 listening_state(ListeningState::INACTIVE) {} 494 listening_state(ListeningState::INACTIVE) {}
503 495
504 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { 496 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() {
505 } 497 }
506 498
507 } // namespace content 499 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698