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

Side by Side Diff: chrome/browser/media/router/mojo/media_router_mojo_impl.cc

Issue 2062333002: mojo::Callback -> base::Callback (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/mojo/media_router_mojo_impl.h" 5 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 output->data.reset(new std::vector<uint8_t>); 60 output->data.reset(new std::vector<uint8_t>);
61 input->data.Swap(output->data.get()); 61 input->data.Swap(output->data.get());
62 return output; 62 return output;
63 } 63 }
64 } 64 }
65 65
66 NOTREACHED() << "Invalid route message type " << input->type; 66 NOTREACHED() << "Invalid route message type " << input->type;
67 return output; 67 return output;
68 } 68 }
69 69
70 void ForwardSinkSearchCallback(const MediaSinkSearchResponseCallback& callback,
71 mojo::String sink_id) {
72 callback.Run(sink_id);
73 }
74
70 } // namespace 75 } // namespace
71 76
72 MediaRouterMojoImpl::MediaRoutesQuery::MediaRoutesQuery() = default; 77 MediaRouterMojoImpl::MediaRoutesQuery::MediaRoutesQuery() = default;
73 78
74 MediaRouterMojoImpl::MediaRoutesQuery::~MediaRoutesQuery() = default; 79 MediaRouterMojoImpl::MediaRoutesQuery::~MediaRoutesQuery() = default;
75 80
76 MediaRouterMojoImpl::MediaSinksQuery::MediaSinksQuery() = default; 81 MediaRouterMojoImpl::MediaSinksQuery::MediaSinksQuery() = default;
77 82
78 MediaRouterMojoImpl::MediaSinksQuery::~MediaSinksQuery() = default; 83 MediaRouterMojoImpl::MediaSinksQuery::~MediaSinksQuery() = default;
79 84
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 FOR_EACH_OBSERVER( 268 FOR_EACH_OBSERVER(
264 MediaRoutesObserver, it->second->observers, 269 MediaRoutesObserver, it->second->observers,
265 OnRoutesUpdated(routes_converted, joinable_routes_converted)); 270 OnRoutesUpdated(routes_converted, joinable_routes_converted));
266 } 271 }
267 272
268 void MediaRouterMojoImpl::RouteResponseReceived( 273 void MediaRouterMojoImpl::RouteResponseReceived(
269 const std::string& presentation_id, 274 const std::string& presentation_id,
270 bool off_the_record, 275 bool off_the_record,
271 const std::vector<MediaRouteResponseCallback>& callbacks, 276 const std::vector<MediaRouteResponseCallback>& callbacks,
272 interfaces::MediaRoutePtr media_route, 277 interfaces::MediaRoutePtr media_route,
273 const mojo::String& error_text, 278 mojo::String error_text,
274 interfaces::RouteRequestResultCode result_code) { 279 interfaces::RouteRequestResultCode result_code) {
275 std::unique_ptr<RouteRequestResult> result; 280 std::unique_ptr<RouteRequestResult> result;
276 if (media_route.is_null()) { 281 if (media_route.is_null()) {
277 // An error occurred. 282 // An error occurred.
278 DCHECK(!error_text.is_null()); 283 DCHECK(!error_text.is_null());
279 std::string error = 284 std::string error =
280 !error_text.get().empty() ? error_text.get() : "Unknown error."; 285 !error_text.get().empty() ? error_text.get() : "Unknown error.";
281 result = RouteRequestResult::FromError( 286 result = RouteRequestResult::FromError(
282 error, mojo::RouteRequestResultCodeFromMojo(result_code)); 287 error, mojo::RouteRequestResultCodeFromMojo(result_code));
283 } else if (media_route->off_the_record != off_the_record) { 288 } else if (media_route->off_the_record != off_the_record) {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 const MediaSink::Id& sink_id, 735 const MediaSink::Id& sink_id,
731 const MediaSource::Id& source_id, 736 const MediaSource::Id& source_id,
732 const std::string& search_input, 737 const std::string& search_input,
733 const std::string& domain, 738 const std::string& domain,
734 const MediaSinkSearchResponseCallback& sink_callback) { 739 const MediaSinkSearchResponseCallback& sink_callback) {
735 DVLOG_WITH_INSTANCE(1) << "SearchSinks"; 740 DVLOG_WITH_INSTANCE(1) << "SearchSinks";
736 auto sink_search_criteria = interfaces::SinkSearchCriteria::New(); 741 auto sink_search_criteria = interfaces::SinkSearchCriteria::New();
737 sink_search_criteria->input = search_input; 742 sink_search_criteria->input = search_input;
738 sink_search_criteria->domain = domain; 743 sink_search_criteria->domain = domain;
739 media_route_provider_->SearchSinks( 744 media_route_provider_->SearchSinks(
740 sink_id, source_id, std::move(sink_search_criteria), sink_callback); 745 sink_id, source_id, std::move(sink_search_criteria),
746 base::Bind(&ForwardSinkSearchCallback, sink_callback));
741 } 747 }
742 748
743 void MediaRouterMojoImpl::OnRouteMessagesReceived( 749 void MediaRouterMojoImpl::OnRouteMessagesReceived(
744 const MediaRoute::Id& route_id, 750 const MediaRoute::Id& route_id,
745 mojo::Array<interfaces::RouteMessagePtr> messages, 751 mojo::Array<interfaces::RouteMessagePtr> messages,
746 bool error) { 752 bool error) {
747 DVLOG(1) << "OnRouteMessagesReceived"; 753 DVLOG(1) << "OnRouteMessagesReceived";
748 754
749 // If |messages| is null, then no more messages will come from this route. 755 // If |messages| is null, then no more messages will come from this route.
750 // We can stop listening. 756 // We can stop listening.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 base::Unretained(this), source_id)); 1037 base::Unretained(this), source_id));
1032 } 1038 }
1033 1039
1034 void MediaRouterMojoImpl::DoUpdateMediaSinks( 1040 void MediaRouterMojoImpl::DoUpdateMediaSinks(
1035 const MediaSource::Id& source_id) { 1041 const MediaSource::Id& source_id) {
1036 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id; 1042 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id;
1037 media_route_provider_->UpdateMediaSinks(source_id); 1043 media_route_provider_->UpdateMediaSinks(source_id);
1038 } 1044 }
1039 1045
1040 } // namespace media_router 1046 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698