| 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/media/router/create_presentation_connection_request.h" | 5 #include "chrome/browser/media/router/create_presentation_connection_request.h" |
| 6 | 6 |
| 7 #include "chrome/browser/media/router/media_source_helper.h" | 7 #include "chrome/browser/media/router/media_source_helper.h" |
| 8 #include "chrome/browser/media/router/route_request_result.h" | 8 #include "chrome/browser/media/router/route_request_result.h" |
| 9 | 9 |
| 10 using content::PresentationSessionInfo; | 10 using content::PresentationSessionInfo; |
| 11 using content::PresentationError; | 11 using content::PresentationError; |
| 12 | 12 |
| 13 namespace media_router { | 13 namespace media_router { |
| 14 | 14 |
| 15 CreatePresentationConnectionRequest::CreatePresentationConnectionRequest( | 15 CreatePresentationConnectionRequest::CreatePresentationConnectionRequest( |
| 16 const RenderFrameHostId& render_frame_host_id, | 16 const RenderFrameHostId& render_frame_host_id, |
| 17 const std::string& presentation_url, | 17 const std::string& presentation_url, |
| 18 const GURL& frame_url, | 18 const GURL& frame_url, |
| 19 const PresentationSessionSuccessCallback& success_cb, | 19 const PresentationSessionSuccessCallback& success_cb, |
| 20 const PresentationSessionErrorCallback& error_cb) | 20 const PresentationSessionErrorCallback& error_cb) |
| 21 : presentation_request_(render_frame_host_id, presentation_url, frame_url), | 21 : presentation_request_(render_frame_host_id, |
| 22 {presentation_url}, |
| 23 frame_url), |
| 22 success_cb_(success_cb), | 24 success_cb_(success_cb), |
| 23 error_cb_(error_cb), | 25 error_cb_(error_cb), |
| 24 cb_invoked_(false) { | 26 cb_invoked_(false) { |
| 25 DCHECK(!success_cb.is_null()); | 27 DCHECK(!success_cb.is_null()); |
| 26 DCHECK(!error_cb.is_null()); | 28 DCHECK(!error_cb.is_null()); |
| 27 } | 29 } |
| 28 | 30 |
| 29 CreatePresentationConnectionRequest::~CreatePresentationConnectionRequest() { | 31 CreatePresentationConnectionRequest::~CreatePresentationConnectionRequest() { |
| 30 if (!cb_invoked_) { | 32 if (!cb_invoked_) { |
| 31 error_cb_.Run(content::PresentationError( | 33 error_cb_.Run(content::PresentationError( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 62 if (!result.route()) { | 64 if (!result.route()) { |
| 63 presentation_request->InvokeErrorCallback(content::PresentationError( | 65 presentation_request->InvokeErrorCallback(content::PresentationError( |
| 64 content::PRESENTATION_ERROR_UNKNOWN, result.error())); | 66 content::PRESENTATION_ERROR_UNKNOWN, result.error())); |
| 65 } else { | 67 } else { |
| 66 presentation_request->InvokeSuccessCallback( | 68 presentation_request->InvokeSuccessCallback( |
| 67 result.presentation_id(), result.route()->media_route_id()); | 69 result.presentation_id(), result.route()->media_route_id()); |
| 68 } | 70 } |
| 69 } | 71 } |
| 70 | 72 |
| 71 } // namespace media_router | 73 } // namespace media_router |
| OLD | NEW |