Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 GURL(chrome::kChromeUIMediaRouterURL)), | 88 GURL(chrome::kChromeUIMediaRouterURL)), |
| 89 cast_config_delegate_(cast_config_delegate) {} | 89 cast_config_delegate_(cast_config_delegate) {} |
| 90 | 90 |
| 91 CastDeviceCache::~CastDeviceCache() {} | 91 CastDeviceCache::~CastDeviceCache() {} |
| 92 | 92 |
| 93 void CastDeviceCache::Init() { | 93 void CastDeviceCache::Init() { |
| 94 CHECK(MediaSinksObserver::Init()); | 94 CHECK(MediaSinksObserver::Init()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void CastDeviceCache::OnSinksReceived(const MediaSinks& sinks) { | 97 void CastDeviceCache::OnSinksReceived(const MediaSinks& sinks) { |
| 98 sinks_ = sinks; | 98 // The media router adds a MediaSink instance that doesn't have a name. Make |
| 99 // sure to filter that sink out from the UI so it is not rendered, as it will | |
| 100 // be a line that only has a icon with no apparent meaning. | |
| 101 sinks_.clear(); | |
| 102 for (const media_router::MediaSink& sink : sinks) { | |
| 103 if (sink.name().empty()) | |
|
amp
2016/06/02 16:49:24
Until we can duplicate the logic in https://cs.chr
jdufault
2016/06/02 17:35:14
Done.
| |
| 104 continue; | |
| 105 | |
| 106 sinks_.push_back(sink); | |
| 107 } | |
| 108 | |
| 99 cast_config_delegate_->RequestDeviceRefresh(); | 109 cast_config_delegate_->RequestDeviceRefresh(); |
| 100 } | 110 } |
| 101 | 111 |
| 102 void CastDeviceCache::OnRoutesUpdated( | 112 void CastDeviceCache::OnRoutesUpdated( |
| 103 const MediaRoutes& routes, | 113 const MediaRoutes& routes, |
| 104 const MediaRouteIds& unused_joinable_route_ids) { | 114 const MediaRouteIds& unused_joinable_route_ids) { |
| 105 routes_ = routes; | 115 routes_ = routes; |
| 106 cast_config_delegate_->RequestDeviceRefresh(); | 116 cast_config_delegate_->RequestDeviceRefresh(); |
| 107 } | 117 } |
| 108 | 118 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 | 227 |
| 218 void CastConfigDelegateMediaRouter::AddObserver( | 228 void CastConfigDelegateMediaRouter::AddObserver( |
| 219 ash::CastConfigDelegate::Observer* observer) { | 229 ash::CastConfigDelegate::Observer* observer) { |
| 220 observer_list_.AddObserver(observer); | 230 observer_list_.AddObserver(observer); |
| 221 } | 231 } |
| 222 | 232 |
| 223 void CastConfigDelegateMediaRouter::RemoveObserver( | 233 void CastConfigDelegateMediaRouter::RemoveObserver( |
| 224 ash::CastConfigDelegate::Observer* observer) { | 234 ash::CastConfigDelegate::Observer* observer) { |
| 225 observer_list_.RemoveObserver(observer); | 235 observer_list_.RemoveObserver(observer); |
| 226 } | 236 } |
| OLD | NEW |