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_client_media_router.h" | 5 #include "chrome/browser/ui/ash/cast_config_client_media_router.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 content::NotificationService::AllSources()); | 147 content::NotificationService::AllSources()); |
148 | 148 |
149 // When starting up, we need to connect to ash and set ourselves as the | 149 // When starting up, we need to connect to ash and set ourselves as the |
150 // client. | 150 // client. |
151 content::ServiceManagerConnection::GetForProcess() | 151 content::ServiceManagerConnection::GetForProcess() |
152 ->GetConnector() | 152 ->GetConnector() |
153 ->BindInterface(ash_util::GetAshServiceName(), &cast_config_); | 153 ->BindInterface(ash_util::GetAshServiceName(), &cast_config_); |
154 | 154 |
155 // Register this object as the client interface implementation. | 155 // Register this object as the client interface implementation. |
156 ash::mojom::CastConfigClientAssociatedPtrInfo ptr_info; | 156 ash::mojom::CastConfigClientAssociatedPtrInfo ptr_info; |
157 binding_.Bind(&ptr_info, cast_config_.associated_group()); | 157 binding_.Bind(&ptr_info); |
158 cast_config_->SetClient(std::move(ptr_info)); | 158 cast_config_->SetClient(std::move(ptr_info)); |
159 } | 159 } |
160 | 160 |
161 CastConfigClientMediaRouter::~CastConfigClientMediaRouter() {} | 161 CastConfigClientMediaRouter::~CastConfigClientMediaRouter() {} |
162 | 162 |
163 CastDeviceCache* CastConfigClientMediaRouter::devices() { | 163 CastDeviceCache* CastConfigClientMediaRouter::devices() { |
164 // The CastDeviceCache instance is lazily allocated because the MediaRouter | 164 // The CastDeviceCache instance is lazily allocated because the MediaRouter |
165 // component is not ready when the constructor is invoked. | 165 // component is not ready when the constructor is invoked. |
166 if (!devices_ && GetMediaRouter()) { | 166 if (!devices_ && GetMediaRouter()) { |
167 devices_ = base::MakeUnique<CastDeviceCache>(this); | 167 devices_ = base::MakeUnique<CastDeviceCache>(this); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 switch (type) { | 242 switch (type) { |
243 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: | 243 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: |
244 // The active profile has changed, which means that the media router has | 244 // The active profile has changed, which means that the media router has |
245 // as well. Reset the device cache to ensure we are using up-to-date | 245 // as well. Reset the device cache to ensure we are using up-to-date |
246 // object instances. | 246 // object instances. |
247 devices_.reset(); | 247 devices_.reset(); |
248 RequestDeviceRefresh(); | 248 RequestDeviceRefresh(); |
249 break; | 249 break; |
250 } | 250 } |
251 } | 251 } |
OLD | NEW |