| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 send_message_callback_.reset(new SendMessageMojoCallback(callback)); | 399 send_message_callback_.reset(new SendMessageMojoCallback(callback)); |
| 400 delegate_->SendMessage( | 400 delegate_->SendMessage( |
| 401 render_process_id_, | 401 render_process_id_, |
| 402 render_frame_id_, | 402 render_frame_id_, |
| 403 GetPresentationSessionMessage(session_message.Pass()), | 403 GetPresentationSessionMessage(session_message.Pass()), |
| 404 base::Bind(&PresentationServiceImpl::OnSendMessageCallback, | 404 base::Bind(&PresentationServiceImpl::OnSendMessageCallback, |
| 405 weak_factory_.GetWeakPtr())); | 405 weak_factory_.GetWeakPtr())); |
| 406 } | 406 } |
| 407 | 407 |
| 408 void PresentationServiceImpl::OnSendMessageCallback() { | 408 void PresentationServiceImpl::OnSendMessageCallback(bool sent) { |
| 409 // It is possible that Reset() is invoked before receiving this callback. | 409 // It is possible that Reset() is invoked before receiving this callback. |
| 410 // So, always check send_message_callback_ for non-null. | 410 // So, always check send_message_callback_ for non-null. |
| 411 if (send_message_callback_) { | 411 if (send_message_callback_) { |
| 412 send_message_callback_->Run(true); | 412 send_message_callback_->Run(sent); |
| 413 send_message_callback_.reset(); | 413 send_message_callback_.reset(); |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 | 416 |
| 417 void PresentationServiceImpl::CloseSession( | 417 void PresentationServiceImpl::CloseSession( |
| 418 const mojo::String& presentation_url, | 418 const mojo::String& presentation_url, |
| 419 const mojo::String& presentation_id) { | 419 const mojo::String& presentation_id) { |
| 420 DVLOG(2) << "CloseSession " << presentation_id; | 420 DVLOG(2) << "CloseSession " << presentation_id; |
| 421 if (delegate_) | 421 if (delegate_) |
| 422 delegate_->CloseSession(render_process_id_, render_frame_id_, | 422 delegate_->CloseSession(render_process_id_, render_frame_id_, |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 void PresentationServiceImpl::DefaultSessionStartContext::Reset() { | 633 void PresentationServiceImpl::DefaultSessionStartContext::Reset() { |
| 634 ScopedVector<DefaultSessionMojoCallback> callbacks; | 634 ScopedVector<DefaultSessionMojoCallback> callbacks; |
| 635 callbacks.swap(callbacks_); | 635 callbacks.swap(callbacks_); |
| 636 for (const auto& callback : callbacks) | 636 for (const auto& callback : callbacks) |
| 637 callback->Run(presentation::PresentationSessionInfoPtr()); | 637 callback->Run(presentation::PresentationSessionInfoPtr()); |
| 638 session_.reset(); | 638 session_.reset(); |
| 639 } | 639 } |
| 640 | 640 |
| 641 } // namespace content | 641 } // namespace content |
| 642 | 642 |
| OLD | NEW |