| 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 sinks_.clear(); |
| 99 for (const media_router::MediaSink& sink : sinks) { |
| 100 // The media router adds a MediaSink instance that doesn't have a name. Make |
| 101 // sure to filter that sink out from the UI so it is not rendered, as it |
| 102 // will be a line that only has a icon with no apparent meaning. |
| 103 if (sink.name().empty()) |
| 104 continue; |
| 105 |
| 106 // Temporarily hide sinks that have a domain. This is to meet cast privacy |
| 107 // requirements. See bug/28691645. |
| 108 if (!sink.domain().empty()) |
| 109 continue; |
| 110 |
| 111 sinks_.push_back(sink); |
| 112 } |
| 113 |
| 99 cast_config_delegate_->RequestDeviceRefresh(); | 114 cast_config_delegate_->RequestDeviceRefresh(); |
| 100 } | 115 } |
| 101 | 116 |
| 102 void CastDeviceCache::OnRoutesUpdated( | 117 void CastDeviceCache::OnRoutesUpdated( |
| 103 const MediaRoutes& routes, | 118 const MediaRoutes& routes, |
| 104 const MediaRouteIds& unused_joinable_route_ids) { | 119 const MediaRouteIds& unused_joinable_route_ids) { |
| 105 routes_ = routes; | 120 routes_ = routes; |
| 106 cast_config_delegate_->RequestDeviceRefresh(); | 121 cast_config_delegate_->RequestDeviceRefresh(); |
| 107 } | 122 } |
| 108 | 123 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 232 |
| 218 void CastConfigDelegateMediaRouter::AddObserver( | 233 void CastConfigDelegateMediaRouter::AddObserver( |
| 219 ash::CastConfigDelegate::Observer* observer) { | 234 ash::CastConfigDelegate::Observer* observer) { |
| 220 observer_list_.AddObserver(observer); | 235 observer_list_.AddObserver(observer); |
| 221 } | 236 } |
| 222 | 237 |
| 223 void CastConfigDelegateMediaRouter::RemoveObserver( | 238 void CastConfigDelegateMediaRouter::RemoveObserver( |
| 224 ash::CastConfigDelegate::Observer* observer) { | 239 ash::CastConfigDelegate::Observer* observer) { |
| 225 observer_list_.RemoveObserver(observer); | 240 observer_list_.RemoveObserver(observer); |
| 226 } | 241 } |
| OLD | NEW |