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

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

Issue 2965843002: [Media Router] Support dual discovery (Closed)
Patch Set: resovle code review comments from Derek and Mark Created 3 years, 5 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 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 bool firewall_can_use_local_ports) { 969 bool firewall_can_use_local_ports) {
970 if (firewall_can_use_local_ports) 970 if (firewall_can_use_local_ports)
971 EnsureMdnsDiscoveryEnabled(); 971 EnsureMdnsDiscoveryEnabled();
972 } 972 }
973 #endif 973 #endif
974 974
975 void MediaRouterMojoImpl::StartDiscovery() { 975 void MediaRouterMojoImpl::StartDiscovery() {
976 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 976 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
977 DVLOG_WITH_INSTANCE(1) << "StartDiscovery"; 977 DVLOG_WITH_INSTANCE(1) << "StartDiscovery";
978 978
979 if (media_router::DialLocalDiscoveryEnabled()) {
980 if (!dial_media_sink_service_proxy_) {
981 dial_media_sink_service_proxy_ = new DialMediaSinkServiceProxy(
982 base::Bind(&MediaRouterMojoImpl::ProvideSinks,
983 weak_factory_.GetWeakPtr(), "dial"),
984 context_);
985 }
986 dial_media_sink_service_proxy_->Start();
987 }
988
989 if (media_router::CastDiscoveryEnabled()) { 979 if (media_router::CastDiscoveryEnabled()) {
990 if (!cast_media_sink_service_) { 980 if (!cast_media_sink_service_) {
991 cast_media_sink_service_ = new CastMediaSinkService( 981 cast_media_sink_service_ = new CastMediaSinkService(
992 base::Bind(&MediaRouterMojoImpl::ProvideSinks, 982 base::Bind(&MediaRouterMojoImpl::ProvideSinks,
993 weak_factory_.GetWeakPtr(), "cast"), 983 weak_factory_.GetWeakPtr(), "cast"),
994 context_); 984 context_);
995 } 985 }
996 cast_media_sink_service_->Start(); 986 cast_media_sink_service_->Start();
997 } 987 }
988
989 if (media_router::DialLocalDiscoveryEnabled()) {
990 if (!dial_media_sink_service_proxy_) {
991 dial_media_sink_service_proxy_ = new DialMediaSinkServiceProxy(
992 base::Bind(&MediaRouterMojoImpl::ProvideSinks,
993 weak_factory_.GetWeakPtr(), "dial"),
994 context_);
995 dial_media_sink_service_proxy_->SetDialMediaSinkServiceDelegate(
996 cast_media_sink_service_.get());
997 }
998 dial_media_sink_service_proxy_->Start();
999 }
998 } 1000 }
999 1001
1000 void MediaRouterMojoImpl::UpdateMediaSinks( 1002 void MediaRouterMojoImpl::UpdateMediaSinks(
1001 const MediaSource::Id& source_id) { 1003 const MediaSource::Id& source_id) {
1002 event_page_request_manager_->RunOrDefer( 1004 event_page_request_manager_->RunOrDefer(
1003 base::BindOnce(&MediaRouterMojoImpl::DoUpdateMediaSinks, 1005 base::BindOnce(&MediaRouterMojoImpl::DoUpdateMediaSinks,
1004 weak_factory_.GetWeakPtr(), source_id), 1006 weak_factory_.GetWeakPtr(), source_id),
1005 MediaRouteProviderWakeReason::UPDATE_MEDIA_SINKS); 1007 MediaRouteProviderWakeReason::UPDATE_MEDIA_SINKS);
1006 } 1008 }
1007 1009
(...skipping 18 matching lines...) Expand all
1026 1028
1027 void MediaRouterMojoImpl::OnMediaControllerCreated( 1029 void MediaRouterMojoImpl::OnMediaControllerCreated(
1028 const MediaRoute::Id& route_id, 1030 const MediaRoute::Id& route_id,
1029 bool success) { 1031 bool success) {
1030 DVLOG_WITH_INSTANCE(1) << "OnMediaControllerCreated: " << route_id 1032 DVLOG_WITH_INSTANCE(1) << "OnMediaControllerCreated: " << route_id
1031 << (success ? " was successful." : " failed."); 1033 << (success ? " was successful." : " failed.");
1032 MediaRouterMojoMetrics::RecordMediaRouteControllerCreationResult(success); 1034 MediaRouterMojoMetrics::RecordMediaRouteControllerCreationResult(success);
1033 } 1035 }
1034 1036
1035 } // namespace media_router 1037 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698