Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: chrome/browser/ui/webui/media_router/media_router_ui.cc

Issue 1761793005: [Media Router] Do not issue a tab mirroring sinks query if tab is not valid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698