| OLD | NEW |
| 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/ui/ash/cast_config_delegate_media_router.h" | 5 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // The CastDeviceCache instance is lazily allocated because the MediaRouter | 144 // The CastDeviceCache instance is lazily allocated because the MediaRouter |
| 145 // component is not ready when the constructor is invoked. | 145 // component is not ready when the constructor is invoked. |
| 146 if (!devices_ && GetMediaRouter() != nullptr) { | 146 if (!devices_ && GetMediaRouter() != nullptr) { |
| 147 devices_.reset(new CastDeviceCache(this)); | 147 devices_.reset(new CastDeviceCache(this)); |
| 148 devices_->Init(); | 148 devices_->Init(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 return devices_.get(); | 151 return devices_.get(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool CastConfigDelegateMediaRouter::HasCastExtension() const { | |
| 155 return true; | |
| 156 } | |
| 157 | |
| 158 void CastConfigDelegateMediaRouter::RequestDeviceRefresh() { | 154 void CastConfigDelegateMediaRouter::RequestDeviceRefresh() { |
| 159 // The media router component isn't ready yet. | 155 // The media router component isn't ready yet. |
| 160 if (!devices()) | 156 if (!devices()) |
| 161 return; | 157 return; |
| 162 | 158 |
| 163 // Build the old-style ReceiverAndActivity set out of the MediaRouter | 159 // Build the old-style ReceiverAndActivity set out of the MediaRouter |
| 164 // source/sink/route setup. We first map the existing sinks, and then we | 160 // source/sink/route setup. We first map the existing sinks, and then we |
| 165 // update those sinks with activity information. | 161 // update those sinks with activity information. |
| 166 | 162 |
| 167 ReceiversAndActivities items; | 163 ReceiversAndActivities items; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 media_router::MediaSourceForDesktop().id(), receiver_id, | 212 media_router::MediaSourceForDesktop().id(), receiver_id, |
| 217 GURL("http://cros-cast-origin/"), nullptr, | 213 GURL("http://cros-cast-origin/"), nullptr, |
| 218 std::vector<media_router::MediaRouteResponseCallback>(), | 214 std::vector<media_router::MediaRouteResponseCallback>(), |
| 219 base::TimeDelta(), false); | 215 base::TimeDelta(), false); |
| 220 } | 216 } |
| 221 | 217 |
| 222 void CastConfigDelegateMediaRouter::StopCasting(const std::string& route_id) { | 218 void CastConfigDelegateMediaRouter::StopCasting(const std::string& route_id) { |
| 223 GetMediaRouter()->TerminateRoute(route_id); | 219 GetMediaRouter()->TerminateRoute(route_id); |
| 224 } | 220 } |
| 225 | 221 |
| 226 bool CastConfigDelegateMediaRouter::HasOptions() const { | |
| 227 // There are no plans to have an options page for the MediaRouter. | |
| 228 return false; | |
| 229 } | |
| 230 | |
| 231 void CastConfigDelegateMediaRouter::LaunchCastOptions() {} | |
| 232 | |
| 233 void CastConfigDelegateMediaRouter::AddObserver( | 222 void CastConfigDelegateMediaRouter::AddObserver( |
| 234 ash::CastConfigDelegate::Observer* observer) { | 223 ash::CastConfigDelegate::Observer* observer) { |
| 235 observer_list_.AddObserver(observer); | 224 observer_list_.AddObserver(observer); |
| 236 } | 225 } |
| 237 | 226 |
| 238 void CastConfigDelegateMediaRouter::RemoveObserver( | 227 void CastConfigDelegateMediaRouter::RemoveObserver( |
| 239 ash::CastConfigDelegate::Observer* observer) { | 228 ash::CastConfigDelegate::Observer* observer) { |
| 240 observer_list_.RemoveObserver(observer); | 229 observer_list_.RemoveObserver(observer); |
| 241 } | 230 } |
| OLD | NEW |