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

Side by Side Diff: chrome/browser/media/router/mojo/media_router_mojo_impl.cc

Issue 1862913004: [Media Router] Wire through a new MRPM call to update media sinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/media/router/mojo/media_router_mojo_impl.h" 5 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 DCHECK(thread_checker_.CalledOnValidThread()); 420 DCHECK(thread_checker_.CalledOnValidThread());
421 issue_manager_.AddIssue(issue); 421 issue_manager_.AddIssue(issue);
422 } 422 }
423 423
424 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) { 424 void MediaRouterMojoImpl::ClearIssue(const Issue::Id& issue_id) {
425 DCHECK(thread_checker_.CalledOnValidThread()); 425 DCHECK(thread_checker_.CalledOnValidThread());
426 issue_manager_.ClearIssue(issue_id); 426 issue_manager_.ClearIssue(issue_id);
427 } 427 }
428 428
429 void MediaRouterMojoImpl::OnUserGesture() { 429 void MediaRouterMojoImpl::OnUserGesture() {
430 DoUserGestureDiscovery();
430 #if defined(OS_WIN) 431 #if defined(OS_WIN)
431 EnsureMdnsDiscoveryEnabled(); 432 EnsureMdnsDiscoveryEnabled();
432 #endif 433 #endif
433 } 434 }
434 435
435 bool MediaRouterMojoImpl::RegisterMediaSinksObserver( 436 bool MediaRouterMojoImpl::RegisterMediaSinksObserver(
436 MediaSinksObserver* observer) { 437 MediaSinksObserver* observer) {
437 DCHECK(thread_checker_.CalledOnValidThread()); 438 DCHECK(thread_checker_.CalledOnValidThread());
438 439
439 // Create an observer list for the media source and add |observer| 440 // Create an observer list for the media source and add |observer|
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 DCHECK(current_wake_reason_ != MediaRouteProviderWakeReason::TOTAL_COUNT); 960 DCHECK(current_wake_reason_ != MediaRouteProviderWakeReason::TOTAL_COUNT);
960 current_wake_reason_ = MediaRouteProviderWakeReason::TOTAL_COUNT; 961 current_wake_reason_ = MediaRouteProviderWakeReason::TOTAL_COUNT;
961 } 962 }
962 963
963 #if defined(OS_WIN) 964 #if defined(OS_WIN)
964 void MediaRouterMojoImpl::EnsureMdnsDiscoveryEnabled() { 965 void MediaRouterMojoImpl::EnsureMdnsDiscoveryEnabled() {
965 if (is_mdns_enabled_) 966 if (is_mdns_enabled_)
966 return; 967 return;
967 968
968 SetWakeReason(MediaRouteProviderWakeReason::ENABLE_MDNS_DISCOVERY); 969 SetWakeReason(MediaRouteProviderWakeReason::ENABLE_MDNS_DISCOVERY);
969 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoEnsureMdnsDiscoveryEnabled, 970 RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoEnsureMdnsDiscoveryEnabled,
amp 2016/04/07 20:37:39 Do I need this RunOrDefer logic for the discovery
apacible 2016/04/08 16:46:44 Good catch; see mfoltz@'s comment in patch set 2.
970 base::Unretained(this))); 971 base::Unretained(this)));
971 should_enable_mdns_discovery_ = true; 972 should_enable_mdns_discovery_ = true;
972 } 973 }
973 974
974 void MediaRouterMojoImpl::DoEnsureMdnsDiscoveryEnabled() { 975 void MediaRouterMojoImpl::DoEnsureMdnsDiscoveryEnabled() {
975 DVLOG_WITH_INSTANCE(1) << "DoEnsureMdnsDiscoveryEnabled"; 976 DVLOG_WITH_INSTANCE(1) << "DoEnsureMdnsDiscoveryEnabled";
976 if (!is_mdns_enabled_) { 977 if (!is_mdns_enabled_) {
977 media_route_provider_->EnableMdnsDiscovery(); 978 media_route_provider_->EnableMdnsDiscovery();
978 is_mdns_enabled_ = true; 979 is_mdns_enabled_ = true;
979 } 980 }
980 } 981 }
981 982
982 void MediaRouterMojoImpl::OnFirewallCheckComplete( 983 void MediaRouterMojoImpl::OnFirewallCheckComplete(
983 bool firewall_can_use_local_ports) { 984 bool firewall_can_use_local_ports) {
984 if (firewall_can_use_local_ports) 985 if (firewall_can_use_local_ports)
985 EnsureMdnsDiscoveryEnabled(); 986 EnsureMdnsDiscoveryEnabled();
986 } 987 }
987 #endif 988 #endif
988 989
990 void MediaRouterMojoImpl::DoUserGestureDiscovery() {
991 media_route_provider_->StartDiscovery();
apacible 2016/04/06 17:50:18 nit: indent
amp 2016/04/07 20:37:39 Done.
992 }
993
989 } // namespace media_router 994 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698