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/media/router/create_presentation_session_request.h" | 5 #include "chrome/browser/media/router/create_presentation_session_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 | 8 |
| 9 using content::PresentationSessionInfo; | 9 using content::PresentationSessionInfo; |
| 10 using content::PresentationError; | 10 using content::PresentationError; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 void CreatePresentationSessionRequest::MaybeInvokeErrorCallback( | 49 void CreatePresentationSessionRequest::MaybeInvokeErrorCallback( |
| 50 const content::PresentationError& error) { | 50 const content::PresentationError& error) { |
| 51 DCHECK(!cb_invoked_); | 51 DCHECK(!cb_invoked_); |
| 52 if (!cb_invoked_) { | 52 if (!cb_invoked_) { |
| 53 error_cb_.Run(error); | 53 error_cb_.Run(error); |
| 54 cb_invoked_ = true; | 54 cb_invoked_ = true; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | |
| 59 void CreatePresentationSessionRequest::HandleRouteResponse( | |
| 60 scoped_ptr<CreatePresentationSessionRequest> presentation_request, | |
| 61 const MediaRoute* route, | |
| 62 const std::string& presentation_id, | |
| 63 const std::string& error) { | |
| 64 DCHECK(presentation_request); | |
|
Wez
2015/08/18 21:50:09
nit: No need to DCHECK here, since both paths de-r
whywhat
2015/08/19 13:04:29
Done.
| |
| 65 if (!route) { | |
| 66 presentation_request->MaybeInvokeErrorCallback( | |
| 67 content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, error)); | |
| 68 } else { | |
| 69 presentation_request->MaybeInvokeSuccessCallback( | |
| 70 presentation_id, route->media_route_id()); | |
| 71 } | |
| 72 } | |
| 73 | |
| 58 } // namespace media_router | 74 } // namespace media_router |
| OLD | NEW |