Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/browser/presentation/presentation_service_impl.h" | 5 #include "content/browser/presentation/presentation_service_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/presentation/presentation_type_converters.h" | 10 #include "content/browser/presentation/presentation_type_converters.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 | 293 |
| 294 // Remove listener for old default presentation URL. | 294 // Remove listener for old default presentation URL. |
| 295 delegate_->RemoveScreenAvailabilityListener( | 295 delegate_->RemoveScreenAvailabilityListener( |
| 296 render_frame_host_->GetProcess()->GetID(), | 296 render_frame_host_->GetProcess()->GetID(), |
| 297 render_frame_host_->GetRoutingID(), | 297 render_frame_host_->GetRoutingID(), |
| 298 old_it->second.get()); | 298 old_it->second.get()); |
| 299 availability_contexts_.erase(old_it); | 299 availability_contexts_.erase(old_it); |
| 300 DoSetDefaultPresentationUrl(new_default_url, default_presentation_id); | 300 DoSetDefaultPresentationUrl(new_default_url, default_presentation_id); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void PresentationServiceImpl::SendStringMessage( | |
| 304 const mojo::String& presentation_url, | |
| 305 const mojo::String& presentation_id, | |
| 306 const mojo::String& message, | |
| 307 const SendMessageMojoCallback& callback) { | |
| 308 if (!delegate_) { | |
| 309 callback.Run(); | |
| 310 return; | |
| 311 } | |
| 312 // TODO(s.singapati): Save the callback into send_message_cb_ptr_ | |
| 313 // and run it after request completion by delegate_. | |
| 314 NOTIMPLEMENTED(); | |
| 315 } | |
| 316 | |
| 303 void PresentationServiceImpl::CloseSession( | 317 void PresentationServiceImpl::CloseSession( |
| 304 const mojo::String& presentation_url, | 318 const mojo::String& presentation_url, |
| 305 const mojo::String& presentation_id) { | 319 const mojo::String& presentation_id) { |
| 306 NOTIMPLEMENTED(); | 320 NOTIMPLEMENTED(); |
| 307 } | 321 } |
| 308 | 322 |
| 309 void PresentationServiceImpl::ListenForSessionStateChange( | 323 void PresentationServiceImpl::ListenForSessionStateChange( |
| 310 const SessionStateCallback& callback) { | 324 const SessionStateCallback& callback) { |
| 311 NOTIMPLEMENTED(); | 325 NOTIMPLEMENTED(); |
| 312 } | 326 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 } | 380 } |
| 367 availability_contexts_.clear(); | 381 availability_contexts_.clear(); |
| 368 for (auto& request_ptr : queued_start_session_requests_) { | 382 for (auto& request_ptr : queued_start_session_requests_) { |
| 369 InvokeNewSessionMojoCallbackWithError(request_ptr->callback); | 383 InvokeNewSessionMojoCallbackWithError(request_ptr->callback); |
| 370 } | 384 } |
| 371 queued_start_session_requests_.clear(); | 385 queued_start_session_requests_.clear(); |
| 372 for (auto& pending_entry : pending_session_cbs_) { | 386 for (auto& pending_entry : pending_session_cbs_) { |
| 373 InvokeNewSessionMojoCallbackWithError(*pending_entry.second); | 387 InvokeNewSessionMojoCallbackWithError(*pending_entry.second); |
| 374 } | 388 } |
| 375 pending_session_cbs_.clear(); | 389 pending_session_cbs_.clear(); |
| 390 | |
| 391 if (send_message_cb_ptr_) { | |
| 392 send_message_cb_ptr_->Run(); | |
|
whywhat
2015/04/13 13:31:21
This might result in the PresentationDispatcher se
USE s.singapati at gmail.com
2015/04/14 17:51:51
Done. callback is Reset for now. May be Mojo disco
| |
| 393 send_message_cb_ptr_.reset(); | |
| 394 } | |
| 376 } | 395 } |
| 377 | 396 |
| 378 void PresentationServiceImpl::InvokeNewSessionMojoCallbackWithError( | 397 void PresentationServiceImpl::InvokeNewSessionMojoCallbackWithError( |
| 379 const NewSessionMojoCallback& callback) { | 398 const NewSessionMojoCallback& callback) { |
| 380 callback.Run( | 399 callback.Run( |
| 381 presentation::PresentationSessionInfoPtr(), | 400 presentation::PresentationSessionInfoPtr(), |
| 382 presentation::PresentationError::From( | 401 presentation::PresentationError::From( |
| 383 PresentationError(PRESENTATION_ERROR_UNKNOWN, "Internal error"))); | 402 PresentationError(PRESENTATION_ERROR_UNKNOWN, "Internal error"))); |
| 384 } | 403 } |
| 385 | 404 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 : presentation_url(presentation_url), | 474 : presentation_url(presentation_url), |
| 456 presentation_id(presentation_id), | 475 presentation_id(presentation_id), |
| 457 callback(callback) { | 476 callback(callback) { |
| 458 } | 477 } |
| 459 | 478 |
| 460 PresentationServiceImpl::StartSessionRequest::~StartSessionRequest() { | 479 PresentationServiceImpl::StartSessionRequest::~StartSessionRequest() { |
| 461 } | 480 } |
| 462 | 481 |
| 463 } // namespace content | 482 } // namespace content |
| 464 | 483 |
| OLD | NEW |