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