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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 DCHECK(host); | 159 DCHECK(host); |
160 auto* const contents = content::WebContents::FromRenderFrameHost(host); | 160 auto* const contents = content::WebContents::FromRenderFrameHost(host); |
161 if (!contents) | 161 if (!contents) |
162 return; | 162 return; |
163 CastRemotingConnector::Get(contents)->CreateBridge(std::move(source), | 163 CastRemotingConnector::Get(contents)->CreateBridge(std::move(source), |
164 std::move(request)); | 164 std::move(request)); |
165 } | 165 } |
166 | 166 |
167 namespace { | 167 namespace { |
168 RemotingSinkCapabilities GetFeatureEnabledCapabilities() { | 168 RemotingSinkCapabilities GetFeatureEnabledCapabilities() { |
169 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 169 #if !defined(OS_ANDROID) |
170 if (base::FeatureList::IsEnabled(features::kMediaRemoting)) { | 170 if (base::FeatureList::IsEnabled(features::kMediaRemoting)) { |
171 return RemotingSinkCapabilities::RENDERING_ONLY; | 171 return RemotingSinkCapabilities::RENDERING_ONLY; |
172 } | 172 } |
173 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 173 #endif |
174 return RemotingSinkCapabilities::NONE; | 174 return RemotingSinkCapabilities::NONE; |
175 } | 175 } |
176 } // namespace | 176 } // namespace |
177 | 177 |
178 CastRemotingConnector::CastRemotingConnector( | 178 CastRemotingConnector::CastRemotingConnector( |
179 media_router::MediaRouter* router, | 179 media_router::MediaRouter* router, |
180 const media_router::MediaSource::Id& media_source_id) | 180 const media_router::MediaSource::Id& media_source_id) |
181 : media_router::MediaRoutesObserver(router), | 181 : media_router::MediaRoutesObserver(router), |
182 media_source_id_(media_source_id), | 182 media_source_id_(media_source_id), |
183 enabled_features_(GetFeatureEnabledCapabilities()), | 183 enabled_features_(GetFeatureEnabledCapabilities()), |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 media_router::MediaRoutesObserver::router(), route.media_route_id(), | 505 media_router::MediaRoutesObserver::router(), route.media_route_id(), |
506 this)); | 506 this)); |
507 // TODO(miu): In the future, scan the route ID for sink capabilities | 507 // TODO(miu): In the future, scan the route ID for sink capabilities |
508 // properties and pass these to the source in the OnSinkAvailable() | 508 // properties and pass these to the source in the OnSinkAvailable() |
509 // notification. | 509 // notification. |
510 for (RemotingBridge* notifyee : bridges_) | 510 for (RemotingBridge* notifyee : bridges_) |
511 notifyee->OnSinkAvailable(enabled_features_); | 511 notifyee->OnSinkAvailable(enabled_features_); |
512 break; | 512 break; |
513 } | 513 } |
514 } | 514 } |
OLD | NEW |