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 "chrome/browser/ui/webui/media_router/media_router_ui.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 &MediaRouterUI::OnRouteResponseReceived, weak_factory_.GetWeakPtr(), | 415 &MediaRouterUI::OnRouteResponseReceived, weak_factory_.GetWeakPtr(), |
| 416 current_route_request_id_, sink_id, cast_mode, | 416 current_route_request_id_, sink_id, cast_mode, |
| 417 base::UTF8ToUTF16(GetTruncatedPresentationRequestSourceName()))); | 417 base::UTF8ToUTF16(GetTruncatedPresentationRequestSourceName()))); |
| 418 if (for_default_source) { | 418 if (for_default_source) { |
| 419 if (create_session_request_) { | 419 if (create_session_request_) { |
| 420 // |create_session_request_| will be nullptr after this call, as the | 420 // |create_session_request_| will be nullptr after this call, as the |
| 421 // object will be transferred to the callback. | 421 // object will be transferred to the callback. |
| 422 route_response_callbacks->push_back( | 422 route_response_callbacks->push_back( |
| 423 base::Bind(&CreatePresentationConnectionRequest::HandleRouteResponse, | 423 base::Bind(&CreatePresentationConnectionRequest::HandleRouteResponse, |
| 424 base::Passed(&create_session_request_))); | 424 base::Passed(&create_session_request_))); |
| 425 route_response_callbacks->push_back( | |
|
imcheng
2016/06/08 01:49:20
I don't think we should invoke MediaRouterUI::OnRo
btolsch
2016/06/08 02:28:50
Done.
| |
| 426 base::Bind(&MediaRouterUI::HandleCreateSessionRequestRouteResponse, | |
| 427 weak_factory_.GetWeakPtr())); | |
| 425 } else if (presentation_service_delegate_) { | 428 } else if (presentation_service_delegate_) { |
| 426 route_response_callbacks->push_back( | 429 route_response_callbacks->push_back( |
| 427 base::Bind(&PresentationServiceDelegateImpl::OnRouteResponse, | 430 base::Bind(&PresentationServiceDelegateImpl::OnRouteResponse, |
| 428 presentation_service_delegate_, *presentation_request_)); | 431 presentation_service_delegate_, *presentation_request_)); |
| 429 } | 432 } |
| 430 } | 433 } |
| 431 | 434 |
| 432 *timeout = GetRouteRequestTimeout(cast_mode); | 435 *timeout = GetRouteRequestTimeout(cast_mode); |
| 433 *off_the_record = Profile::FromWebUI(web_ui())->IsOffTheRecord(); | 436 *off_the_record = Profile::FromWebUI(web_ui())->IsOffTheRecord(); |
| 434 | 437 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 DVLOG(1) << "MediaRouteResponse returned error: " << result.error(); | 539 DVLOG(1) << "MediaRouteResponse returned error: " << result.error(); |
| 537 } | 540 } |
| 538 | 541 |
| 539 handler_->OnCreateRouteResponseReceived(sink_id, route); | 542 handler_->OnCreateRouteResponseReceived(sink_id, route); |
| 540 current_route_request_id_ = -1; | 543 current_route_request_id_ = -1; |
| 541 | 544 |
| 542 if (result.result_code() == RouteRequestResult::TIMED_OUT) | 545 if (result.result_code() == RouteRequestResult::TIMED_OUT) |
| 543 SendIssueForRouteTimeout(cast_mode, presentation_request_source_name); | 546 SendIssueForRouteTimeout(cast_mode, presentation_request_source_name); |
| 544 } | 547 } |
| 545 | 548 |
| 549 void MediaRouterUI::HandleCreateSessionRequestRouteResponse( | |
| 550 const RouteRequestResult&) { | |
| 551 Close(); | |
| 552 } | |
| 553 | |
| 546 void MediaRouterUI::OnSearchSinkResponseReceived( | 554 void MediaRouterUI::OnSearchSinkResponseReceived( |
| 547 MediaCastMode cast_mode, | 555 MediaCastMode cast_mode, |
| 548 const MediaSink::Id& found_sink_id) { | 556 const MediaSink::Id& found_sink_id) { |
| 549 DVLOG(1) << "OnSearchSinkResponseReceived"; | 557 DVLOG(1) << "OnSearchSinkResponseReceived"; |
| 550 handler_->ReturnSearchResult(found_sink_id); | 558 handler_->ReturnSearchResult(found_sink_id); |
| 551 | 559 |
| 552 MediaSource::Id source_id; | 560 MediaSource::Id source_id; |
| 553 GURL origin; | 561 GURL origin; |
| 554 std::vector<MediaRouteResponseCallback> route_response_callbacks; | 562 std::vector<MediaRouteResponseCallback> route_response_callbacks; |
| 555 base::TimeDelta timeout; | 563 base::TimeDelta timeout; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 base::Time::Now() - start_time_); | 662 base::Time::Now() - start_time_); |
| 655 start_time_ = base::Time(); | 663 start_time_ = base::Time(); |
| 656 } | 664 } |
| 657 } | 665 } |
| 658 | 666 |
| 659 void MediaRouterUI::UpdateMaxDialogHeight(int height) { | 667 void MediaRouterUI::UpdateMaxDialogHeight(int height) { |
| 660 handler_->UpdateMaxDialogHeight(height); | 668 handler_->UpdateMaxDialogHeight(height); |
| 661 } | 669 } |
| 662 | 670 |
| 663 } // namespace media_router | 671 } // namespace media_router |
| OLD | NEW |