| 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/webui/media_router/media_router_ui.h" | 5 #include "chrome/browser/ui/webui/media_router/media_router_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 collator_.reset( | 257 collator_.reset( |
| 258 icu::Collator::createInstance(icu::Locale(locale.c_str()), error)); | 258 icu::Collator::createInstance(icu::Locale(locale.c_str()), error)); |
| 259 if (U_FAILURE(error)) { | 259 if (U_FAILURE(error)) { |
| 260 DLOG(ERROR) << "Failed to create collator for locale " << locale; | 260 DLOG(ERROR) << "Failed to create collator for locale " << locale; |
| 261 collator_.reset(); | 261 collator_.reset(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 query_result_manager_.reset(new QueryResultManager(router_)); | 264 query_result_manager_.reset(new QueryResultManager(router_)); |
| 265 query_result_manager_->AddObserver(this); | 265 query_result_manager_->AddObserver(this); |
| 266 | 266 |
| 267 // These modes are always available. | 267 // Desktop mirror mode is always available. |
| 268 query_result_manager_->StartSinksQuery(MediaCastMode::DESKTOP_MIRROR, | 268 query_result_manager_->StartSinksQuery(MediaCastMode::DESKTOP_MIRROR, |
| 269 MediaSourceForDesktop()); | 269 MediaSourceForDesktop()); |
| 270 initiator_ = initiator; | 270 initiator_ = initiator; |
| 271 MediaSource mirroring_source( | 271 SessionID::id_type tab_id = SessionTabHelper::IdForTab(initiator); |
| 272 MediaSourceForTab(SessionTabHelper::IdForTab(initiator))); | 272 if (tab_id != -1) { |
| 273 query_result_manager_->StartSinksQuery(MediaCastMode::TAB_MIRROR, | 273 MediaSource mirroring_source(MediaSourceForTab(tab_id)); |
| 274 mirroring_source); | 274 query_result_manager_->StartSinksQuery(MediaCastMode::TAB_MIRROR, |
| 275 mirroring_source); |
| 276 } |
| 275 UpdateCastModes(); | 277 UpdateCastModes(); |
| 276 } | 278 } |
| 277 | 279 |
| 278 void MediaRouterUI::InitForTest(MediaRouter* router, | 280 void MediaRouterUI::InitForTest(MediaRouter* router, |
| 279 content::WebContents* initiator, | 281 content::WebContents* initiator, |
| 280 MediaRouterWebUIMessageHandler* handler) { | 282 MediaRouterWebUIMessageHandler* handler) { |
| 281 router_ = router; | 283 router_ = router; |
| 282 handler_ = handler; | 284 handler_ = handler; |
| 283 InitCommon(initiator); | 285 InitCommon(initiator); |
| 284 } | 286 } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 base::Time::Now() - start_time_); | 574 base::Time::Now() - start_time_); |
| 573 start_time_ = base::Time(); | 575 start_time_ = base::Time(); |
| 574 } | 576 } |
| 575 } | 577 } |
| 576 | 578 |
| 577 void MediaRouterUI::UpdateMaxDialogHeight(int height) { | 579 void MediaRouterUI::UpdateMaxDialogHeight(int height) { |
| 578 handler_->UpdateMaxDialogHeight(height); | 580 handler_->UpdateMaxDialogHeight(height); |
| 579 } | 581 } |
| 580 | 582 |
| 581 } // namespace media_router | 583 } // namespace media_router |
| OLD | NEW |