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

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

Issue 1177073003: [MediaRouter] Update MR-2-Extension's PostMessage to return boolean. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename SendMessage to SendRouteMessage Created 5 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/media_router_mojo_impl.h" 5 #include "chrome/browser/media/router/media_router_mojo_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 base::Unretained(this), source_id, sink_id, callback)); 167 base::Unretained(this), source_id, sink_id, callback));
168 } 168 }
169 169
170 void MediaRouterMojoImpl::CloseRoute(const MediaRoute::Id& route_id) { 170 void MediaRouterMojoImpl::CloseRoute(const MediaRoute::Id& route_id) {
171 DCHECK(thread_checker_.CalledOnValidThread()); 171 DCHECK(thread_checker_.CalledOnValidThread());
172 172
173 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoCloseRoute, 173 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoCloseRoute,
174 base::Unretained(this), route_id)); 174 base::Unretained(this), route_id));
175 } 175 }
176 176
177 void MediaRouterMojoImpl::PostMessage(const MediaRoute::Id& route_id, 177 void MediaRouterMojoImpl::SendRouteMessage(
178 const std::string& message) { 178 const MediaRoute::Id& route_id,
179 const std::string& message,
180 const SendRouteMessageCallback& callback) {
179 DCHECK(thread_checker_.CalledOnValidThread()); 181 DCHECK(thread_checker_.CalledOnValidThread());
180 182
181 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoPostMessage, 183 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoSendSessionMessage,
182 base::Unretained(this), route_id, message)); 184 base::Unretained(this), route_id, message, callback));
183 } 185 }
184 186
185 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) { 187 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) {
186 DCHECK(thread_checker_.CalledOnValidThread()); 188 DCHECK(thread_checker_.CalledOnValidThread());
187 189
188 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoClearIssue, 190 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoClearIssue,
189 base::Unretained(this), issue_id)); 191 base::Unretained(this), issue_id));
190 } 192 }
191 193
192 void MediaRouterMojoImpl::RegisterMediaSinksObserver( 194 void MediaRouterMojoImpl::RegisterMediaSinksObserver(
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 DVLOG_WITH_INSTANCE(1) << "CreateRoute " << source_id << "=>" << sink_id; 276 DVLOG_WITH_INSTANCE(1) << "CreateRoute " << source_id << "=>" << sink_id;
275 mojo_media_router_->CreateRoute( 277 mojo_media_router_->CreateRoute(
276 source_id, sink_id, base::Bind(&CreateRouteFinished, sink_id, callback)); 278 source_id, sink_id, base::Bind(&CreateRouteFinished, sink_id, callback));
277 } 279 }
278 280
279 void MediaRouterMojoImpl::DoCloseRoute(const MediaRoute::Id& route_id) { 281 void MediaRouterMojoImpl::DoCloseRoute(const MediaRoute::Id& route_id) {
280 DVLOG_WITH_INSTANCE(1) << "CloseRoute " << route_id; 282 DVLOG_WITH_INSTANCE(1) << "CloseRoute " << route_id;
281 mojo_media_router_->CloseRoute(route_id); 283 mojo_media_router_->CloseRoute(route_id);
282 } 284 }
283 285
284 void MediaRouterMojoImpl::DoPostMessage(const MediaRoute::Id& route_id, 286 void MediaRouterMojoImpl::DoSendSessionMessage(
285 const std::string& message) { 287 const MediaRoute::Id& route_id,
286 DVLOG_WITH_INSTANCE(1) << "PostMessage " << route_id; 288 const std::string& message,
287 mojo_media_router_->PostMessage(route_id, message); 289 const SendRouteMessageCallback& callback) {
290 DVLOG_WITH_INSTANCE(1) << "SendRouteMessage " << route_id;
291 mojo_media_router_->SendRouteMessage(route_id, message, callback);
288 } 292 }
289 293
290 void MediaRouterMojoImpl::DoClearIssue(const Issue::Id& issue_id) { 294 void MediaRouterMojoImpl::DoClearIssue(const Issue::Id& issue_id) {
291 DVLOG_WITH_INSTANCE(1) << "ClearIssue " << issue_id; 295 DVLOG_WITH_INSTANCE(1) << "ClearIssue " << issue_id;
292 mojo_media_router_->ClearIssue(issue_id); 296 mojo_media_router_->ClearIssue(issue_id);
293 } 297 }
294 298
295 void MediaRouterMojoImpl::DoStartObservingMediaSinks( 299 void MediaRouterMojoImpl::DoStartObservingMediaSinks(
296 const std::string& source_id) { 300 const std::string& source_id) {
297 DVLOG_WITH_INSTANCE(1) << "StartObservingMediaSinks: " << source_id; 301 DVLOG_WITH_INSTANCE(1) << "StartObservingMediaSinks: " << source_id;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return; 362 return;
359 } 363 }
360 364
361 for (const auto& next_request : pending_requests_) 365 for (const auto& next_request : pending_requests_)
362 next_request.Run(); 366 next_request.Run();
363 367
364 pending_requests_.clear(); 368 pending_requests_.clear();
365 } 369 }
366 370
367 } // namespace media_router 371 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/browser/media/router/media_router_mojo_impl.h ('k') | chrome/browser/media/router/media_router_mojo_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698