| 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/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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (!pending_requests_.empty()) { | 127 if (!pending_requests_.empty()) { |
| 128 DLOG_WITH_INSTANCE(ERROR) << "A connection error while there are pending " | 128 DLOG_WITH_INSTANCE(ERROR) << "A connection error while there are pending " |
| 129 "requests."; | 129 "requests."; |
| 130 SetWakeReason(MediaRouteProviderWakeReason::CONNECTION_ERROR); | 130 SetWakeReason(MediaRouteProviderWakeReason::CONNECTION_ERROR); |
| 131 AttemptWakeEventPage(); | 131 AttemptWakeEventPage(); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void MediaRouterMojoImpl::RegisterMediaRouteProvider( | 135 void MediaRouterMojoImpl::RegisterMediaRouteProvider( |
| 136 mojom::MediaRouteProviderPtr media_route_provider_ptr, | 136 mojom::MediaRouteProviderPtr media_route_provider_ptr, |
| 137 const mojom::MediaRouter::RegisterMediaRouteProviderCallback& | 137 mojom::MediaRouter::RegisterMediaRouteProviderCallback callback) { |
| 138 callback) { | |
| 139 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 138 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 140 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 141 // The MRPM may have been upgraded or otherwise reload such that we could be | 140 // The MRPM may have been upgraded or otherwise reload such that we could be |
| 142 // seeing an MRPM that doesn't know mDNS is enabled, even if we've told a | 141 // seeing an MRPM that doesn't know mDNS is enabled, even if we've told a |
| 143 // previously registered MRPM it should be enabled. Furthermore, there may be | 142 // previously registered MRPM it should be enabled. Furthermore, there may be |
| 144 // a pending request to enable mDNS, so don't clear this flag after | 143 // a pending request to enable mDNS, so don't clear this flag after |
| 145 // ExecutePendingRequests(). | 144 // ExecutePendingRequests(). |
| 146 is_mdns_enabled_ = false; | 145 is_mdns_enabled_ = false; |
| 147 #endif | 146 #endif |
| 148 if (event_page_tracker_->IsEventPageSuspended( | 147 if (event_page_tracker_->IsEventPageSuspended( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 159 media_route_provider_ = std::move(media_route_provider_ptr); | 158 media_route_provider_ = std::move(media_route_provider_ptr); |
| 160 media_route_provider_.set_connection_error_handler(base::Bind( | 159 media_route_provider_.set_connection_error_handler(base::Bind( |
| 161 &MediaRouterMojoImpl::OnConnectionError, base::Unretained(this))); | 160 &MediaRouterMojoImpl::OnConnectionError, base::Unretained(this))); |
| 162 | 161 |
| 163 auto config = mojom::MediaRouteProviderConfig::New(); | 162 auto config = mojom::MediaRouteProviderConfig::New(); |
| 164 // Enabling browser side discovery means disabling extension side discovery. | 163 // Enabling browser side discovery means disabling extension side discovery. |
| 165 // We are migrating discovery from the external Media Route Provider to the | 164 // We are migrating discovery from the external Media Route Provider to the |
| 166 // Media Router (crbug.com/687383), so we need to disable it in the provider. | 165 // Media Router (crbug.com/687383), so we need to disable it in the provider. |
| 167 config->enable_dial_discovery = !media_router::DialLocalDiscoveryEnabled(); | 166 config->enable_dial_discovery = !media_router::DialLocalDiscoveryEnabled(); |
| 168 config->enable_cast_discovery = !media_router::CastDiscoveryEnabled(); | 167 config->enable_cast_discovery = !media_router::CastDiscoveryEnabled(); |
| 169 callback.Run(instance_id_, std::move(config)); | 168 std::move(callback).Run(instance_id_, std::move(config)); |
| 170 ExecutePendingRequests(); | 169 ExecutePendingRequests(); |
| 171 SyncStateToMediaRouteProvider(); | 170 SyncStateToMediaRouteProvider(); |
| 172 | 171 |
| 173 wakeup_attempt_count_ = 0; | 172 wakeup_attempt_count_ = 0; |
| 174 } | 173 } |
| 175 | 174 |
| 176 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { | 175 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { |
| 177 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 176 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 178 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; | 177 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; |
| 179 issue_manager_.AddIssue(issue); | 178 issue_manager_.AddIssue(issue); |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 | 1121 |
| 1123 void MediaRouterMojoImpl::OnMediaControllerCreated( | 1122 void MediaRouterMojoImpl::OnMediaControllerCreated( |
| 1124 const MediaRoute::Id& route_id, | 1123 const MediaRoute::Id& route_id, |
| 1125 bool success) { | 1124 bool success) { |
| 1126 DVLOG_WITH_INSTANCE(1) << "OnMediaControllerCreated: " << route_id | 1125 DVLOG_WITH_INSTANCE(1) << "OnMediaControllerCreated: " << route_id |
| 1127 << (success ? " was successful." : " failed."); | 1126 << (success ? " was successful." : " failed."); |
| 1128 MediaRouterMojoMetrics::RecordMediaRouteControllerCreationResult(success); | 1127 MediaRouterMojoMetrics::RecordMediaRouteControllerCreationResult(success); |
| 1129 } | 1128 } |
| 1130 | 1129 |
| 1131 } // namespace media_router | 1130 } // namespace media_router |
| OLD | NEW |