| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/cast_remoting_connector.h" | 5 #include "chrome/browser/media/cast_remoting_connector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 void CastRemotingConnector::SendMessageToSink( | 330 void CastRemotingConnector::SendMessageToSink( |
| 331 RemotingBridge* bridge, const std::vector<uint8_t>& message) { | 331 RemotingBridge* bridge, const std::vector<uint8_t>& message) { |
| 332 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 332 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 333 | 333 |
| 334 // During an active remoting session, simply pass all binary messages through | 334 // During an active remoting session, simply pass all binary messages through |
| 335 // to the sink. | 335 // to the sink. |
| 336 if (!message_observer_ || active_bridge_ != bridge) | 336 if (!message_observer_ || active_bridge_ != bridge) |
| 337 return; | 337 return; |
| 338 media_router::MediaRoutesObserver::router()->SendRouteBinaryMessage( | 338 media_router::MediaRoutesObserver::router()->SendRouteBinaryMessage( |
| 339 message_observer_->route_id(), | 339 message_observer_->route_id(), message, |
| 340 base::MakeUnique<std::vector<uint8_t>>(message), | |
| 341 base::Bind(&CastRemotingConnector::HandleSendMessageResult, | 340 base::Bind(&CastRemotingConnector::HandleSendMessageResult, |
| 342 weak_factory_.GetWeakPtr())); | 341 weak_factory_.GetWeakPtr())); |
| 343 } | 342 } |
| 344 | 343 |
| 345 void CastRemotingConnector::SendMessageToProvider(const std::string& message) { | 344 void CastRemotingConnector::SendMessageToProvider(const std::string& message) { |
| 346 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 345 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 347 | 346 |
| 348 if (!message_observer_) | 347 if (!message_observer_) |
| 349 return; | 348 return; |
| 350 | 349 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 media_router::MediaRoutesObserver::router(), route.media_route_id(), | 503 media_router::MediaRoutesObserver::router(), route.media_route_id(), |
| 505 this)); | 504 this)); |
| 506 // TODO(miu): In the future, scan the route ID for sink capabilities | 505 // TODO(miu): In the future, scan the route ID for sink capabilities |
| 507 // properties and pass these to the source in the OnSinkAvailable() | 506 // properties and pass these to the source in the OnSinkAvailable() |
| 508 // notification. | 507 // notification. |
| 509 for (RemotingBridge* notifyee : bridges_) | 508 for (RemotingBridge* notifyee : bridges_) |
| 510 notifyee->OnSinkAvailable(enabled_features_); | 509 notifyee->OnSinkAvailable(enabled_features_); |
| 511 break; | 510 break; |
| 512 } | 511 } |
| 513 } | 512 } |
| OLD | NEW |