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

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

Issue 1693963003: Pass origin to StartObservingMediaSinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for Review Created 4 years, 10 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
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 collator_.reset( 240 collator_.reset(
241 icu::Collator::createInstance(icu::Locale(locale.c_str()), error)); 241 icu::Collator::createInstance(icu::Locale(locale.c_str()), error));
242 if (U_FAILURE(error)) { 242 if (U_FAILURE(error)) {
243 DLOG(ERROR) << "Failed to create collator for locale " << locale; 243 DLOG(ERROR) << "Failed to create collator for locale " << locale;
244 collator_.reset(); 244 collator_.reset();
245 } 245 }
246 246
247 query_result_manager_.reset(new QueryResultManager(router_)); 247 query_result_manager_.reset(new QueryResultManager(router_));
248 query_result_manager_->AddObserver(this); 248 query_result_manager_->AddObserver(this);
249 249
250 // Requesting route for mirroring. Use a placeholder URL as origin.
251 GURL origin = GURL(chrome::kChromeUIMediaRouterURL);
252 DCHECK(origin.is_valid());
253
250 // These modes are always available. 254 // These modes are always available.
251 query_result_manager_->StartSinksQuery(MediaCastMode::DESKTOP_MIRROR, 255 query_result_manager_->StartSinksQuery(MediaCastMode::DESKTOP_MIRROR,
252 MediaSourceForDesktop()); 256 MediaSourceForDesktop(),
257 origin);
253 initiator_ = initiator; 258 initiator_ = initiator;
254 MediaSource mirroring_source( 259 MediaSource mirroring_source(
255 MediaSourceForTab(SessionTabHelper::IdForTab(initiator))); 260 MediaSourceForTab(SessionTabHelper::IdForTab(initiator)));
256 query_result_manager_->StartSinksQuery(MediaCastMode::TAB_MIRROR, 261 query_result_manager_->StartSinksQuery(MediaCastMode::TAB_MIRROR,
257 mirroring_source); 262 mirroring_source,
263 origin);
258 UpdateCastModes(); 264 UpdateCastModes();
259 } 265 }
260 266
261 void MediaRouterUI::OnDefaultPresentationChanged( 267 void MediaRouterUI::OnDefaultPresentationChanged(
262 const PresentationRequest& presentation_request) { 268 const PresentationRequest& presentation_request) {
263 MediaSource source = presentation_request.GetMediaSource(); 269 MediaSource source = presentation_request.GetMediaSource();
264 presentation_request_.reset(new PresentationRequest(presentation_request)); 270 presentation_request_.reset(new PresentationRequest(presentation_request));
265 query_result_manager_->StartSinksQuery(MediaCastMode::DEFAULT, source); 271 query_result_manager_->StartSinksQuery(MediaCastMode::DEFAULT,
272 source, GetFrameURL());
266 // Register for MediaRoute updates. 273 // Register for MediaRoute updates.
267 routes_observer_.reset(new UIMediaRoutesObserver( 274 routes_observer_.reset(new UIMediaRoutesObserver(
268 router_, source.id(), 275 router_, source.id(),
269 base::Bind(&MediaRouterUI::OnRoutesUpdated, base::Unretained(this)))); 276 base::Bind(&MediaRouterUI::OnRoutesUpdated, base::Unretained(this))));
270 277
271 UpdateCastModes(); 278 UpdateCastModes();
272 } 279 }
273 280
274 void MediaRouterUI::OnDefaultPresentationRemoved() { 281 void MediaRouterUI::OnDefaultPresentationRemoved() {
275 presentation_request_.reset(); 282 presentation_request_.reset();
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 base::Time::Now() - start_time_); 542 base::Time::Now() - start_time_);
536 start_time_ = base::Time(); 543 start_time_ = base::Time();
537 } 544 }
538 } 545 }
539 546
540 void MediaRouterUI::UpdateMaxDialogHeight(int height) { 547 void MediaRouterUI::UpdateMaxDialogHeight(int height) {
541 handler_->UpdateMaxDialogHeight(height); 548 handler_->UpdateMaxDialogHeight(height);
542 } 549 }
543 550
544 } // namespace media_router 551 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698