Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/browser/media/router/create_presentation_connection_request.cc

Issue 1314413005: [Presentation API] 1-UA presentation support + presenter APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
(...skipping 17 matching lines...) Expand all
28 28
29 CreatePresentationConnectionRequest::~CreatePresentationConnectionRequest() { 29 CreatePresentationConnectionRequest::~CreatePresentationConnectionRequest() {
30 if (!cb_invoked_) { 30 if (!cb_invoked_) {
31 error_cb_.Run(content::PresentationError( 31 error_cb_.Run(content::PresentationError(
32 content::PRESENTATION_ERROR_UNKNOWN, "Unknown error.")); 32 content::PRESENTATION_ERROR_UNKNOWN, "Unknown error."));
33 } 33 }
34 } 34 }
35 35
36 void CreatePresentationConnectionRequest::InvokeSuccessCallback( 36 void CreatePresentationConnectionRequest::InvokeSuccessCallback(
37 const std::string& presentation_id, 37 const std::string& presentation_id,
38 const MediaRoute::Id& route_id) { 38 const MediaRoute& route) {
39 DCHECK(!cb_invoked_); 39 DCHECK(!cb_invoked_);
40 if (!cb_invoked_) { 40 if (!cb_invoked_) {
41 success_cb_.Run( 41 success_cb_.Run(
42 content::PresentationSessionInfo( 42 content::PresentationSessionInfo(
43 presentation_request_.presentation_url(), presentation_id), 43 presentation_request_.presentation_url(), presentation_id),
44 route_id); 44 route);
45 cb_invoked_ = true; 45 cb_invoked_ = true;
46 } 46 }
47 } 47 }
48 48
49 void CreatePresentationConnectionRequest::InvokeErrorCallback( 49 void CreatePresentationConnectionRequest::InvokeErrorCallback(
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 58 // static
59 void CreatePresentationConnectionRequest::HandleRouteResponse( 59 void CreatePresentationConnectionRequest::HandleRouteResponse(
60 std::unique_ptr<CreatePresentationConnectionRequest> presentation_request, 60 std::unique_ptr<CreatePresentationConnectionRequest> presentation_request,
61 const RouteRequestResult& result) { 61 const RouteRequestResult& result) {
62 if (!result.route()) { 62 if (!result.route()) {
63 presentation_request->InvokeErrorCallback(content::PresentationError( 63 presentation_request->InvokeErrorCallback(content::PresentationError(
64 content::PRESENTATION_ERROR_UNKNOWN, result.error())); 64 content::PRESENTATION_ERROR_UNKNOWN, result.error()));
65 } else { 65 } else {
66 presentation_request->InvokeSuccessCallback( 66 presentation_request->InvokeSuccessCallback(result.presentation_id(),
67 result.presentation_id(), result.route()->media_route_id()); 67 *result.route());
68 } 68 }
69 } 69 }
70 70
71 } // namespace media_router 71 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698