| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 if (!pending_requests_.empty()) { | 120 if (!pending_requests_.empty()) { |
| 121 DLOG_WITH_INSTANCE(ERROR) << "A connection error while there are pending " | 121 DLOG_WITH_INSTANCE(ERROR) << "A connection error while there are pending " |
| 122 "requests."; | 122 "requests."; |
| 123 SetWakeReason(MediaRouteProviderWakeReason::CONNECTION_ERROR); | 123 SetWakeReason(MediaRouteProviderWakeReason::CONNECTION_ERROR); |
| 124 AttemptWakeEventPage(); | 124 AttemptWakeEventPage(); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 void MediaRouterMojoImpl::RegisterMediaRouteProvider( | 128 void MediaRouterMojoImpl::RegisterMediaRouteProvider( |
| 129 mojom::MediaRouteProviderPtr media_route_provider_ptr, | 129 mojom::MediaRouteProviderPtr media_route_provider_ptr, |
| 130 const mojom::MediaRouter::RegisterMediaRouteProviderCallback& | 130 mojom::MediaRouter::RegisterMediaRouteProviderCallback callback) { |
| 131 callback) { | |
| 132 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 131 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 133 #if defined(OS_WIN) | 132 #if defined(OS_WIN) |
| 134 // The MRPM may have been upgraded or otherwise reload such that we could be | 133 // The MRPM may have been upgraded or otherwise reload such that we could be |
| 135 // seeing an MRPM that doesn't know mDNS is enabled, even if we've told a | 134 // seeing an MRPM that doesn't know mDNS is enabled, even if we've told a |
| 136 // previously registered MRPM it should be enabled. Furthermore, there may be | 135 // previously registered MRPM it should be enabled. Furthermore, there may be |
| 137 // a pending request to enable mDNS, so don't clear this flag after | 136 // a pending request to enable mDNS, so don't clear this flag after |
| 138 // ExecutePendingRequests(). | 137 // ExecutePendingRequests(). |
| 139 is_mdns_enabled_ = false; | 138 is_mdns_enabled_ = false; |
| 140 #endif | 139 #endif |
| 141 if (event_page_tracker_->IsEventPageSuspended( | 140 if (event_page_tracker_->IsEventPageSuspended( |
| 142 media_route_provider_extension_id_)) { | 141 media_route_provider_extension_id_)) { |
| 143 DVLOG_WITH_INSTANCE(1) | 142 DVLOG_WITH_INSTANCE(1) |
| 144 << "RegisterMediaRouteProvider was called while extension is " | 143 << "RegisterMediaRouteProvider was called while extension is " |
| 145 "suspended."; | 144 "suspended."; |
| 146 media_route_provider_.reset(); | 145 media_route_provider_.reset(); |
| 147 SetWakeReason(MediaRouteProviderWakeReason::REGISTER_MEDIA_ROUTE_PROVIDER); | 146 SetWakeReason(MediaRouteProviderWakeReason::REGISTER_MEDIA_ROUTE_PROVIDER); |
| 148 AttemptWakeEventPage(); | 147 AttemptWakeEventPage(); |
| 149 return; | 148 return; |
| 150 } | 149 } |
| 151 | 150 |
| 152 media_route_provider_ = std::move(media_route_provider_ptr); | 151 media_route_provider_ = std::move(media_route_provider_ptr); |
| 153 media_route_provider_.set_connection_error_handler(base::Bind( | 152 media_route_provider_.set_connection_error_handler(base::Bind( |
| 154 &MediaRouterMojoImpl::OnConnectionError, base::Unretained(this))); | 153 &MediaRouterMojoImpl::OnConnectionError, base::Unretained(this))); |
| 155 callback.Run(instance_id_); | 154 std::move(callback).Run(instance_id_); |
| 156 ExecutePendingRequests(); | 155 ExecutePendingRequests(); |
| 157 SyncStateToMediaRouteProvider(); | 156 SyncStateToMediaRouteProvider(); |
| 158 | 157 |
| 159 wakeup_attempt_count_ = 0; | 158 wakeup_attempt_count_ = 0; |
| 160 } | 159 } |
| 161 | 160 |
| 162 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { | 161 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { |
| 163 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 162 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 164 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; | 163 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; |
| 165 issue_manager_.AddIssue(issue); | 164 issue_manager_.AddIssue(issue); |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 | 1089 |
| 1091 void MediaRouterMojoImpl::OnMediaControllerCreated( | 1090 void MediaRouterMojoImpl::OnMediaControllerCreated( |
| 1092 const MediaRoute::Id& route_id, | 1091 const MediaRoute::Id& route_id, |
| 1093 bool success) { | 1092 bool success) { |
| 1094 // TODO(takumif): Record success/failure with UMA. | 1093 // TODO(takumif): Record success/failure with UMA. |
| 1095 DVLOG_WITH_INSTANCE(1) << "OnMediaControllerCreated: " << route_id | 1094 DVLOG_WITH_INSTANCE(1) << "OnMediaControllerCreated: " << route_id |
| 1096 << (success ? " was successful." : " failed."); | 1095 << (success ? " was successful." : " failed."); |
| 1097 } | 1096 } |
| 1098 | 1097 |
| 1099 } // namespace media_router | 1098 } // namespace media_router |
| OLD | NEW |