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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 delegate_->ListenForConnectionStateChange( | 290 delegate_->ListenForConnectionStateChange( |
| 291 render_process_id_, render_frame_id_, connection, | 291 render_process_id_, render_frame_id_, connection, |
| 292 base::Bind(&PresentationServiceImpl::OnConnectionStateChanged, | 292 base::Bind(&PresentationServiceImpl::OnConnectionStateChanged, |
| 293 weak_factory_.GetWeakPtr(), connection)); | 293 weak_factory_.GetWeakPtr(), connection)); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 void PresentationServiceImpl::OnStartSessionSucceeded( | 297 void PresentationServiceImpl::OnStartSessionSucceeded( |
| 298 int request_session_id, | 298 int request_session_id, |
| 299 const PresentationSessionInfo& session_info) { | 299 const PresentationSessionInfo& session_info) { |
| 300 DVLOG(2) << "PresentationServiceImpl::OnStartSessionSucceeded" | |
|
mark a. foltz
2016/11/03 18:32:05
Please remove log statements here and below. It's
zhaobin
2016/11/03 23:00:46
Done.
| |
| 301 << " [is_offscreen]: " << session_info.is_offscreen; | |
| 300 if (request_session_id != start_session_request_id_) | 302 if (request_session_id != start_session_request_id_) |
| 301 return; | 303 return; |
| 302 | 304 |
| 303 CHECK(pending_start_session_cb_.get()); | 305 CHECK(pending_start_session_cb_.get()); |
| 304 pending_start_session_cb_->Run( | 306 pending_start_session_cb_->Run( |
| 305 blink::mojom::PresentationSessionInfo::From(session_info), | 307 blink::mojom::PresentationSessionInfo::From(session_info), |
| 306 blink::mojom::PresentationErrorPtr()); | 308 blink::mojom::PresentationErrorPtr()); |
| 307 ListenForConnectionStateChange(session_info); | 309 ListenForConnectionStateChange(session_info); |
| 308 pending_start_session_cb_.reset(); | 310 pending_start_session_cb_.reset(); |
| 309 start_session_request_id_ = kInvalidRequestSessionId; | 311 start_session_request_id_ = kInvalidRequestSessionId; |
| 310 } | 312 } |
| 311 | 313 |
| 312 void PresentationServiceImpl::OnStartSessionError( | 314 void PresentationServiceImpl::OnStartSessionError( |
| 313 int request_session_id, | 315 int request_session_id, |
| 314 const PresentationError& error) { | 316 const PresentationError& error) { |
| 315 if (request_session_id != start_session_request_id_) | 317 if (request_session_id != start_session_request_id_) |
| 316 return; | 318 return; |
| 317 | 319 |
| 318 CHECK(pending_start_session_cb_.get()); | 320 CHECK(pending_start_session_cb_.get()); |
| 319 pending_start_session_cb_->Run(blink::mojom::PresentationSessionInfoPtr(), | 321 pending_start_session_cb_->Run(blink::mojom::PresentationSessionInfoPtr(), |
| 320 blink::mojom::PresentationError::From(error)); | 322 blink::mojom::PresentationError::From(error)); |
| 321 pending_start_session_cb_.reset(); | 323 pending_start_session_cb_.reset(); |
| 322 start_session_request_id_ = kInvalidRequestSessionId; | 324 start_session_request_id_ = kInvalidRequestSessionId; |
| 323 } | 325 } |
| 324 | 326 |
| 325 void PresentationServiceImpl::OnJoinSessionSucceeded( | 327 void PresentationServiceImpl::OnJoinSessionSucceeded( |
| 326 int request_session_id, | 328 int request_session_id, |
| 327 const PresentationSessionInfo& session_info) { | 329 const PresentationSessionInfo& session_info) { |
| 330 DVLOG(2) << "PresentationServiceImpl::OnJoinSessionSucceeded" | |
| 331 << " [is_offscreen]: " << session_info.is_offscreen; | |
| 328 if (RunAndEraseJoinSessionMojoCallback( | 332 if (RunAndEraseJoinSessionMojoCallback( |
| 329 request_session_id, | 333 request_session_id, |
| 330 blink::mojom::PresentationSessionInfo::From(session_info), | 334 blink::mojom::PresentationSessionInfo::From(session_info), |
| 331 blink::mojom::PresentationErrorPtr())) { | 335 blink::mojom::PresentationErrorPtr())) { |
| 332 ListenForConnectionStateChange(session_info); | 336 ListenForConnectionStateChange(session_info); |
| 333 } | 337 } |
| 334 } | 338 } |
| 335 | 339 |
| 336 void PresentationServiceImpl::OnJoinSessionError( | 340 void PresentationServiceImpl::OnJoinSessionError( |
| 337 int request_session_id, | 341 int request_session_id, |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 } | 550 } |
| 547 | 551 |
| 548 void PresentationServiceImpl::OnDelegateDestroyed() { | 552 void PresentationServiceImpl::OnDelegateDestroyed() { |
| 549 DVLOG(2) << "PresentationServiceImpl::OnDelegateDestroyed"; | 553 DVLOG(2) << "PresentationServiceImpl::OnDelegateDestroyed"; |
| 550 delegate_ = nullptr; | 554 delegate_ = nullptr; |
| 551 Reset(); | 555 Reset(); |
| 552 } | 556 } |
| 553 | 557 |
| 554 void PresentationServiceImpl::OnDefaultPresentationStarted( | 558 void PresentationServiceImpl::OnDefaultPresentationStarted( |
| 555 const PresentationSessionInfo& connection) { | 559 const PresentationSessionInfo& connection) { |
| 560 DVLOG(2) << "PresentationServiceImpl::OnDefaultPresentationStarted" | |
| 561 << " [is_offscreen]: " << connection.is_offscreen; | |
| 556 DCHECK(client_.get()); | 562 DCHECK(client_.get()); |
| 557 client_->OnDefaultSessionStarted( | 563 client_->OnDefaultSessionStarted( |
| 558 blink::mojom::PresentationSessionInfo::From(connection)); | 564 blink::mojom::PresentationSessionInfo::From(connection)); |
| 559 ListenForConnectionStateChange(connection); | 565 ListenForConnectionStateChange(connection); |
| 560 } | 566 } |
| 561 | 567 |
| 562 PresentationServiceImpl::ScreenAvailabilityListenerImpl:: | 568 PresentationServiceImpl::ScreenAvailabilityListenerImpl:: |
| 563 ScreenAvailabilityListenerImpl(const GURL& availability_url, | 569 ScreenAvailabilityListenerImpl(const GURL& availability_url, |
| 564 PresentationServiceImpl* service) | 570 PresentationServiceImpl* service) |
| 565 : availability_url_(availability_url), service_(service) { | 571 : availability_url_(availability_url), service_(service) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 599 | 605 |
| 600 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( | 606 void PresentationServiceImpl::NewSessionCallbackWrapper::Run( |
| 601 blink::mojom::PresentationSessionInfoPtr session, | 607 blink::mojom::PresentationSessionInfoPtr session, |
| 602 blink::mojom::PresentationErrorPtr error) { | 608 blink::mojom::PresentationErrorPtr error) { |
| 603 DCHECK(!callback_.is_null()); | 609 DCHECK(!callback_.is_null()); |
| 604 callback_.Run(std::move(session), std::move(error)); | 610 callback_.Run(std::move(session), std::move(error)); |
| 605 callback_.Reset(); | 611 callback_.Reset(); |
| 606 } | 612 } |
| 607 | 613 |
| 608 } // namespace content | 614 } // namespace content |
| OLD | NEW |