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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 DCHECK(contents); | 139 DCHECK(contents); |
140 CastRemotingConnector* connector = | 140 CastRemotingConnector* connector = |
141 static_cast<CastRemotingConnector*>(contents->GetUserData(kUserDataKey)); | 141 static_cast<CastRemotingConnector*>(contents->GetUserData(kUserDataKey)); |
142 if (!connector) { | 142 if (!connector) { |
143 connector = new CastRemotingConnector( | 143 connector = new CastRemotingConnector( |
144 media_router::MediaRouterFactory::GetApiForBrowserContext( | 144 media_router::MediaRouterFactory::GetApiForBrowserContext( |
145 contents->GetBrowserContext()), | 145 contents->GetBrowserContext()), |
146 media_router::MediaSourceForTabContentRemoting( | 146 media_router::MediaSourceForTabContentRemoting( |
147 SessionTabHelper::IdForTab(contents)) | 147 SessionTabHelper::IdForTab(contents)) |
148 .id()); | 148 .id()); |
149 contents->SetUserData(kUserDataKey, connector); | 149 contents->SetUserData(kUserDataKey, base::WrapUnique(connector)); |
150 } | 150 } |
151 return connector; | 151 return connector; |
152 } | 152 } |
153 | 153 |
154 // static | 154 // static |
155 void CastRemotingConnector::CreateMediaRemoter( | 155 void CastRemotingConnector::CreateMediaRemoter( |
156 content::RenderFrameHost* host, | 156 content::RenderFrameHost* host, |
157 media::mojom::RemotingSourcePtr source, | 157 media::mojom::RemotingSourcePtr source, |
158 media::mojom::RemoterRequest request) { | 158 media::mojom::RemoterRequest request) { |
159 DCHECK(host); | 159 DCHECK(host); |
(...skipping 345 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 |