| 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/presentation_service_delegate_impl.h" | 5 #include "chrome/browser/media/router/presentation_service_delegate_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
| 10 #include "base/containers/small_map.h" | 10 #include "base/containers/small_map.h" |
| 11 #include "base/guid.h" | 11 #include "base/guid.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "chrome/browser/media/router/create_presentation_session_request.h" | 14 #include "chrome/browser/media/router/create_presentation_connection_request.h" |
| 15 #include "chrome/browser/media/router/media_route.h" | 15 #include "chrome/browser/media/router/media_route.h" |
| 16 #include "chrome/browser/media/router/media_router.h" | 16 #include "chrome/browser/media/router/media_router.h" |
| 17 #include "chrome/browser/media/router/media_router_dialog_controller.h" | 17 #include "chrome/browser/media/router/media_router_dialog_controller.h" |
| 18 #include "chrome/browser/media/router/media_router_factory.h" | 18 #include "chrome/browser/media/router/media_router_factory.h" |
| 19 #include "chrome/browser/media/router/media_sink.h" | 19 #include "chrome/browser/media/router/media_sink.h" |
| 20 #include "chrome/browser/media/router/media_source_helper.h" | 20 #include "chrome/browser/media/router/media_source_helper.h" |
| 21 #include "chrome/browser/media/router/presentation_media_sinks_observer.h" | 21 #include "chrome/browser/media/router/presentation_media_sinks_observer.h" |
| 22 #include "chrome/browser/media/router/presentation_session_messages_observer.h" | 22 #include "chrome/browser/media/router/presentation_session_messages_observer.h" |
| 23 #include "chrome/browser/media/router/presentation_session_state_observer.h" | 23 #include "chrome/browser/media/router/presentation_session_state_observer.h" |
| 24 #include "chrome/browser/sessions/session_tab_helper.h" | 24 #include "chrome/browser/sessions/session_tab_helper.h" |
| 25 #include "content/public/browser/presentation_screen_availability_listener.h" | 25 #include "content/public/browser/presentation_screen_availability_listener.h" |
| 26 #include "content/public/browser/presentation_session.h" | 26 #include "content/public/browser/presentation_session.h" |
| 27 #include "content/public/browser/render_frame_host.h" | 27 #include "content/public/browser/render_frame_host.h" |
| 28 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
| 29 | 29 |
| 30 DEFINE_WEB_CONTENTS_USER_DATA_KEY( | 30 DEFINE_WEB_CONTENTS_USER_DATA_KEY( |
| 31 media_router::PresentationServiceDelegateImpl); | 31 media_router::PresentationServiceDelegateImpl); |
| 32 | 32 |
| 33 using content::RenderFrameHost; | 33 using content::RenderFrameHost; |
| 34 | 34 |
| 35 namespace media_router { | 35 namespace media_router { |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 using DelegateObserver = content::PresentationServiceDelegate::Observer; | 39 using DelegateObserver = content::PresentationServiceDelegate::Observer; |
| 40 using PresentationSessionErrorCallback = | |
| 41 content::PresentationServiceDelegate::PresentationSessionErrorCallback; | |
| 42 using PresentationSessionSuccessCallback = | |
| 43 content::PresentationServiceDelegate::PresentationSessionSuccessCallback; | |
| 44 | 40 |
| 45 // Returns the unique identifier for the supplied RenderFrameHost. | 41 // Returns the unique identifier for the supplied RenderFrameHost. |
| 46 RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) { | 42 RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) { |
| 47 int render_process_id = render_frame_host->GetProcess()->GetID(); | 43 int render_process_id = render_frame_host->GetProcess()->GetID(); |
| 48 int render_frame_id = render_frame_host->GetRoutingID(); | 44 int render_frame_id = render_frame_host->GetRoutingID(); |
| 49 return RenderFrameHostId(render_process_id, render_frame_id); | 45 return RenderFrameHostId(render_process_id, render_frame_id); |
| 50 } | 46 } |
| 51 | 47 |
| 52 // Gets the last committed URL for the render frame specified by | 48 // Gets the last committed URL for the render frame specified by |
| 53 // |render_frame_host_id|. | 49 // |render_frame_host_id|. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 77 bool RemoveScreenAvailabilityListener( | 73 bool RemoveScreenAvailabilityListener( |
| 78 content::PresentationScreenAvailabilityListener* listener); | 74 content::PresentationScreenAvailabilityListener* listener); |
| 79 bool HasScreenAvailabilityListenerForTest( | 75 bool HasScreenAvailabilityListenerForTest( |
| 80 const MediaSource::Id& source_id) const; | 76 const MediaSource::Id& source_id) const; |
| 81 std::string GetDefaultPresentationId() const; | 77 std::string GetDefaultPresentationId() const; |
| 82 void ListenForSessionStateChange( | 78 void ListenForSessionStateChange( |
| 83 const content::SessionStateChangedCallback& state_changed_cb); | 79 const content::SessionStateChangedCallback& state_changed_cb); |
| 84 void ListenForSessionMessages( | 80 void ListenForSessionMessages( |
| 85 const content::PresentationSessionInfo& session, | 81 const content::PresentationSessionInfo& session, |
| 86 const content::PresentationSessionMessageCallback& message_cb); | 82 const content::PresentationSessionMessageCallback& message_cb); |
| 83 |
| 87 void Reset(); | 84 void Reset(); |
| 88 | 85 |
| 89 const MediaRoute::Id GetRouteId(const std::string& presentation_id) const; | 86 const MediaRoute::Id GetRouteId(const std::string& presentation_id) const; |
| 90 const std::vector<MediaRoute::Id> GetRouteIds() const; | 87 const std::vector<MediaRoute::Id> GetRouteIds() const; |
| 91 void OnPresentationSessionClosed(const std::string& presentation_id); | 88 void OnPresentationSessionClosed(const std::string& presentation_id); |
| 92 | 89 |
| 93 void OnPresentationSessionStarted( | 90 void OnPresentationSessionStarted( |
| 94 bool is_default_presentation, | |
| 95 const content::PresentationSessionInfo& session, | 91 const content::PresentationSessionInfo& session, |
| 96 const MediaRoute::Id& route_id); | 92 const MediaRoute::Id& route_id); |
| 97 void OnPresentationServiceDelegateDestroyed() const; | 93 void OnPresentationServiceDelegateDestroyed() const; |
| 98 | 94 |
| 99 void set_delegate_observer(DelegateObserver* observer) { | 95 void set_delegate_observer(DelegateObserver* observer) { |
| 100 delegate_observer_ = observer; | 96 delegate_observer_ = observer; |
| 101 } | 97 } |
| 102 | 98 |
| 103 private: | 99 private: |
| 104 MediaSource GetMediaSourceFromListener( | 100 MediaSource GetMediaSourceFromListener( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 128 | 124 |
| 129 PresentationFrame::~PresentationFrame() { | 125 PresentationFrame::~PresentationFrame() { |
| 130 } | 126 } |
| 131 | 127 |
| 132 void PresentationFrame::OnPresentationServiceDelegateDestroyed() const { | 128 void PresentationFrame::OnPresentationServiceDelegateDestroyed() const { |
| 133 if (delegate_observer_) | 129 if (delegate_observer_) |
| 134 delegate_observer_->OnDelegateDestroyed(); | 130 delegate_observer_->OnDelegateDestroyed(); |
| 135 } | 131 } |
| 136 | 132 |
| 137 void PresentationFrame::OnPresentationSessionStarted( | 133 void PresentationFrame::OnPresentationSessionStarted( |
| 138 bool is_default_presentation, | |
| 139 const content::PresentationSessionInfo& session, | 134 const content::PresentationSessionInfo& session, |
| 140 const MediaRoute::Id& route_id) { | 135 const MediaRoute::Id& route_id) { |
| 141 presentation_id_to_route_id_[session.presentation_id] = route_id; | 136 presentation_id_to_route_id_[session.presentation_id] = route_id; |
| 142 route_id_to_presentation_.Add(route_id, session); | 137 route_id_to_presentation_.Add(route_id, session); |
| 143 if (session_state_observer_) | 138 if (session_state_observer_) |
| 144 session_state_observer_->OnPresentationSessionConnected(route_id); | 139 session_state_observer_->OnPresentationSessionConnected(route_id); |
| 145 if (is_default_presentation && delegate_observer_) | |
| 146 delegate_observer_->OnDefaultPresentationStarted(session); | |
| 147 } | 140 } |
| 148 | 141 |
| 149 void PresentationFrame::OnPresentationSessionClosed( | 142 void PresentationFrame::OnPresentationSessionClosed( |
| 150 const std::string& presentation_id) { | 143 const std::string& presentation_id) { |
| 151 auto it = presentation_id_to_route_id_.find(presentation_id); | 144 auto it = presentation_id_to_route_id_.find(presentation_id); |
| 152 if (it != presentation_id_to_route_id_.end()) { | 145 if (it != presentation_id_to_route_id_.end()) { |
| 153 route_id_to_presentation_.Remove(it->second); | 146 route_id_to_presentation_.Remove(it->second); |
| 154 presentation_id_to_route_id_.erase(it); | 147 presentation_id_to_route_id_.erase(it); |
| 155 } | 148 } |
| 156 // TODO(imcheng): Notify |session_state_observer_|? | 149 // TODO(imcheng): Notify |session_state_observer_|? |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void PresentationFrame::Reset() { | 197 void PresentationFrame::Reset() { |
| 205 route_id_to_presentation_.Clear(); | 198 route_id_to_presentation_.Clear(); |
| 206 | 199 |
| 207 for (const auto& pid_route_id : presentation_id_to_route_id_) | 200 for (const auto& pid_route_id : presentation_id_to_route_id_) |
| 208 router_->OnPresentationSessionDetached(pid_route_id.second); | 201 router_->OnPresentationSessionDetached(pid_route_id.second); |
| 209 | 202 |
| 210 presentation_id_to_route_id_.clear(); | 203 presentation_id_to_route_id_.clear(); |
| 211 sinks_observer_.reset(); | 204 sinks_observer_.reset(); |
| 212 if (session_state_observer_) | 205 if (session_state_observer_) |
| 213 session_state_observer_->Reset(); | 206 session_state_observer_->Reset(); |
| 207 |
| 214 session_messages_observers_.clear(); | 208 session_messages_observers_.clear(); |
| 215 } | 209 } |
| 216 | 210 |
| 217 void PresentationFrame::ListenForSessionStateChange( | 211 void PresentationFrame::ListenForSessionStateChange( |
| 218 const content::SessionStateChangedCallback& state_changed_cb) { | 212 const content::SessionStateChangedCallback& state_changed_cb) { |
| 219 CHECK(!session_state_observer_.get()); | 213 CHECK(!session_state_observer_.get()); |
| 220 session_state_observer_.reset(new PresentationSessionStateObserver( | 214 session_state_observer_.reset(new PresentationSessionStateObserver( |
| 221 state_changed_cb, &route_id_to_presentation_, router_)); | 215 state_changed_cb, &route_id_to_presentation_, router_)); |
| 222 } | 216 } |
| 223 | 217 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 bool RemoveScreenAvailabilityListener( | 252 bool RemoveScreenAvailabilityListener( |
| 259 const RenderFrameHostId& render_frame_host_id, | 253 const RenderFrameHostId& render_frame_host_id, |
| 260 content::PresentationScreenAvailabilityListener* listener); | 254 content::PresentationScreenAvailabilityListener* listener); |
| 261 void ListenForSessionStateChange( | 255 void ListenForSessionStateChange( |
| 262 const RenderFrameHostId& render_frame_host_id, | 256 const RenderFrameHostId& render_frame_host_id, |
| 263 const content::SessionStateChangedCallback& state_changed_cb); | 257 const content::SessionStateChangedCallback& state_changed_cb); |
| 264 void ListenForSessionMessages( | 258 void ListenForSessionMessages( |
| 265 const RenderFrameHostId& render_frame_host_id, | 259 const RenderFrameHostId& render_frame_host_id, |
| 266 const content::PresentationSessionInfo& session, | 260 const content::PresentationSessionInfo& session, |
| 267 const content::PresentationSessionMessageCallback& message_cb); | 261 const content::PresentationSessionMessageCallback& message_cb); |
| 262 |
| 263 // Sets or clears the default presentation request and callback for the given |
| 264 // frame. Also sets / clears the default presentation requests for the owning |
| 265 // tab WebContents. |
| 266 void SetDefaultPresentationUrl( |
| 267 const RenderFrameHostId& render_frame_host_id, |
| 268 const std::string& default_presentation_url, |
| 269 const content::PresentationSessionStartedCallback& callback); |
| 268 void AddDelegateObserver(const RenderFrameHostId& render_frame_host_id, | 270 void AddDelegateObserver(const RenderFrameHostId& render_frame_host_id, |
| 269 DelegateObserver* observer); | 271 DelegateObserver* observer); |
| 270 void RemoveDelegateObserver(const RenderFrameHostId& render_frame_host_id); | 272 void RemoveDelegateObserver(const RenderFrameHostId& render_frame_host_id); |
| 273 void AddDefaultPresentationRequestObserver( |
| 274 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver* |
| 275 observer); |
| 276 void RemoveDefaultPresentationRequestObserver( |
| 277 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver* |
| 278 observer); |
| 271 void Reset(const RenderFrameHostId& render_frame_host_id); | 279 void Reset(const RenderFrameHostId& render_frame_host_id); |
| 272 bool HasScreenAvailabilityListenerForTest( | 280 bool HasScreenAvailabilityListenerForTest( |
| 273 const RenderFrameHostId& render_frame_host_id, | 281 const RenderFrameHostId& render_frame_host_id, |
| 274 const MediaSource::Id& source_id) const; | 282 const MediaSource::Id& source_id) const; |
| 275 void SetMediaRouterForTest(MediaRouter* router); | 283 void SetMediaRouterForTest(MediaRouter* router); |
| 276 | 284 |
| 277 void OnPresentationSessionStarted( | 285 void OnPresentationSessionStarted( |
| 278 const RenderFrameHostId& render_frame_host_id, | 286 const RenderFrameHostId& render_frame_host_id, |
| 279 bool is_default_presentation, | 287 const content::PresentationSessionInfo& session, |
| 288 const MediaRoute::Id& route_id); |
| 289 void OnDefaultPresentationSessionStarted( |
| 290 const PresentationRequest& request, |
| 280 const content::PresentationSessionInfo& session, | 291 const content::PresentationSessionInfo& session, |
| 281 const MediaRoute::Id& route_id); | 292 const MediaRoute::Id& route_id); |
| 282 | 293 |
| 283 void OnPresentationSessionClosed( | 294 void OnPresentationSessionClosed( |
| 284 const RenderFrameHostId& render_frame_host_id, | 295 const RenderFrameHostId& render_frame_host_id, |
| 285 const std::string& presentation_id); | 296 const std::string& presentation_id); |
| 286 const MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id, | 297 const MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id, |
| 287 const std::string& presentation_id) const; | 298 const std::string& presentation_id) const; |
| 288 const std::vector<MediaRoute::Id> GetRouteIds( | 299 const std::vector<MediaRoute::Id> GetRouteIds( |
| 289 const RenderFrameHostId& render_frame_host_id) const; | 300 const RenderFrameHostId& render_frame_host_id) const; |
| 290 | 301 |
| 302 const PresentationRequest* default_presentation_request() const { |
| 303 return default_presentation_request_.get(); |
| 304 } |
| 305 |
| 291 private: | 306 private: |
| 292 PresentationFrame* GetOrAddPresentationFrame( | 307 PresentationFrame* GetOrAddPresentationFrame( |
| 293 const RenderFrameHostId& render_frame_host_id); | 308 const RenderFrameHostId& render_frame_host_id); |
| 294 | 309 |
| 310 // Sets the default presentation request for the owning WebContents and |
| 311 // notifies observers of changes. |
| 312 void SetDefaultPresentationRequest( |
| 313 const PresentationRequest& default_presentation_request); |
| 314 |
| 315 // Clears the default presentation request for the owning WebContents and |
| 316 // notifies observers of changes. Also resets |
| 317 // |default_presentation_started_callback_|. |
| 318 void ClearDefaultPresentationRequest(); |
| 319 |
| 320 bool IsMainFrame(const RenderFrameHostId& render_frame_host_id) const; |
| 321 |
| 295 // Maps a frame identifier to a PresentationFrame object for frames | 322 // Maps a frame identifier to a PresentationFrame object for frames |
| 296 // that are using presentation API. | 323 // that are using presentation API. |
| 297 base::ScopedPtrHashMap<RenderFrameHostId, scoped_ptr<PresentationFrame>> | 324 base::ScopedPtrHashMap<RenderFrameHostId, scoped_ptr<PresentationFrame>> |
| 298 presentation_frames_; | 325 presentation_frames_; |
| 299 | 326 |
| 327 // Default presentation request for the owning tab WebContents. |
| 328 scoped_ptr<PresentationRequest> default_presentation_request_; |
| 329 |
| 330 // Callback to invoke when default presentation has started. |
| 331 content::PresentationSessionStartedCallback |
| 332 default_presentation_started_callback_; |
| 333 |
| 334 // References to the observers listening for changes to this tab WebContent's |
| 335 // default presentation. |
| 336 base::ObserverList< |
| 337 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver> |
| 338 default_presentation_request_observers_; |
| 339 |
| 300 // References to the owning WebContents, and the corresponding MediaRouter. | 340 // References to the owning WebContents, and the corresponding MediaRouter. |
| 301 MediaRouter* router_; | 341 MediaRouter* router_; |
| 302 content::WebContents* web_contents_; | 342 content::WebContents* web_contents_; |
| 303 }; | 343 }; |
| 304 | 344 |
| 305 PresentationFrameManager::PresentationFrameManager( | 345 PresentationFrameManager::PresentationFrameManager( |
| 306 content::WebContents* web_contents, | 346 content::WebContents* web_contents, |
| 307 MediaRouter* router) | 347 MediaRouter* router) |
| 308 : router_(router), web_contents_(web_contents) { | 348 : router_(router), web_contents_(web_contents) { |
| 309 DCHECK(web_contents_); | 349 DCHECK(web_contents_); |
| 310 DCHECK(router_); | 350 DCHECK(router_); |
| 311 } | 351 } |
| 312 | 352 |
| 313 PresentationFrameManager::~PresentationFrameManager() { | 353 PresentationFrameManager::~PresentationFrameManager() { |
| 314 for (auto& frame : presentation_frames_) | 354 for (auto& frame : presentation_frames_) |
| 315 frame.second->OnPresentationServiceDelegateDestroyed(); | 355 frame.second->OnPresentationServiceDelegateDestroyed(); |
| 316 } | 356 } |
| 317 | 357 |
| 318 void PresentationFrameManager::OnPresentationSessionStarted( | 358 void PresentationFrameManager::OnPresentationSessionStarted( |
| 319 const RenderFrameHostId& render_frame_host_id, | 359 const RenderFrameHostId& render_frame_host_id, |
| 320 bool is_default_presentation, | |
| 321 const content::PresentationSessionInfo& session, | 360 const content::PresentationSessionInfo& session, |
| 322 const MediaRoute::Id& route_id) { | 361 const MediaRoute::Id& route_id) { |
| 323 auto presentation_frame = presentation_frames_.get(render_frame_host_id); | 362 auto presentation_frame = presentation_frames_.get(render_frame_host_id); |
| 324 if (presentation_frame) | 363 if (presentation_frame) |
| 325 presentation_frame->OnPresentationSessionStarted(is_default_presentation, | 364 presentation_frame->OnPresentationSessionStarted(session, route_id); |
| 326 session, route_id); | 365 } |
| 366 |
| 367 void PresentationFrameManager::OnDefaultPresentationSessionStarted( |
| 368 const PresentationRequest& request, |
| 369 const content::PresentationSessionInfo& session, |
| 370 const MediaRoute::Id& route_id) { |
| 371 auto presentation_frame = |
| 372 presentation_frames_.get(request.render_frame_host_id()); |
| 373 if (presentation_frame) |
| 374 presentation_frame->OnPresentationSessionStarted(session, route_id); |
| 375 |
| 376 if (default_presentation_request_ && |
| 377 default_presentation_request_->Equals(request)) { |
| 378 default_presentation_started_callback_.Run(session); |
| 379 } |
| 327 } | 380 } |
| 328 | 381 |
| 329 void PresentationFrameManager::OnPresentationSessionClosed( | 382 void PresentationFrameManager::OnPresentationSessionClosed( |
| 330 const RenderFrameHostId& render_frame_host_id, | 383 const RenderFrameHostId& render_frame_host_id, |
| 331 const std::string& presentation_id) { | 384 const std::string& presentation_id) { |
| 332 auto presentation_frame = presentation_frames_.get(render_frame_host_id); | 385 auto presentation_frame = presentation_frames_.get(render_frame_host_id); |
| 333 if (presentation_frame) | 386 if (presentation_frame) |
| 334 presentation_frame->OnPresentationSessionClosed(presentation_id); | 387 presentation_frame->OnPresentationSessionClosed(presentation_id); |
| 335 } | 388 } |
| 336 | 389 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 presentation_frames_.get(render_frame_host_id); | 443 presentation_frames_.get(render_frame_host_id); |
| 391 if (!presentation_frame) { | 444 if (!presentation_frame) { |
| 392 DVLOG(2) << "ListenForSessionMessages: PresentationFrame does not exist " | 445 DVLOG(2) << "ListenForSessionMessages: PresentationFrame does not exist " |
| 393 << "for: (" << render_frame_host_id.first << ", " | 446 << "for: (" << render_frame_host_id.first << ", " |
| 394 << render_frame_host_id.second << ")"; | 447 << render_frame_host_id.second << ")"; |
| 395 return; | 448 return; |
| 396 } | 449 } |
| 397 presentation_frame->ListenForSessionMessages(session, message_cb); | 450 presentation_frame->ListenForSessionMessages(session, message_cb); |
| 398 } | 451 } |
| 399 | 452 |
| 453 void PresentationFrameManager::SetDefaultPresentationUrl( |
| 454 const RenderFrameHostId& render_frame_host_id, |
| 455 const std::string& default_presentation_url, |
| 456 const content::PresentationSessionStartedCallback& callback) { |
| 457 if (!IsMainFrame(render_frame_host_id)) |
| 458 return; |
| 459 |
| 460 if (default_presentation_url.empty()) { |
| 461 ClearDefaultPresentationRequest(); |
| 462 } else { |
| 463 DCHECK(!callback.is_null()); |
| 464 GURL frame_url(GetLastCommittedURLForFrame(render_frame_host_id)); |
| 465 PresentationRequest request(render_frame_host_id, default_presentation_url, |
| 466 frame_url); |
| 467 default_presentation_started_callback_ = callback; |
| 468 SetDefaultPresentationRequest(request); |
| 469 } |
| 470 } |
| 471 |
| 400 void PresentationFrameManager::AddDelegateObserver( | 472 void PresentationFrameManager::AddDelegateObserver( |
| 401 const RenderFrameHostId& render_frame_host_id, | 473 const RenderFrameHostId& render_frame_host_id, |
| 402 DelegateObserver* observer) { | 474 DelegateObserver* observer) { |
| 403 auto presentation_frame = GetOrAddPresentationFrame(render_frame_host_id); | 475 auto presentation_frame = GetOrAddPresentationFrame(render_frame_host_id); |
| 404 presentation_frame->set_delegate_observer(observer); | 476 presentation_frame->set_delegate_observer(observer); |
| 405 } | 477 } |
| 406 | 478 |
| 407 void PresentationFrameManager::RemoveDelegateObserver( | 479 void PresentationFrameManager::RemoveDelegateObserver( |
| 408 const RenderFrameHostId& render_frame_host_id) { | 480 const RenderFrameHostId& render_frame_host_id) { |
| 409 auto presentation_frame = presentation_frames_.get(render_frame_host_id); | 481 auto presentation_frame = presentation_frames_.get(render_frame_host_id); |
| 410 if (presentation_frame) { | 482 if (presentation_frame) { |
| 411 presentation_frame->set_delegate_observer(nullptr); | 483 presentation_frame->set_delegate_observer(nullptr); |
| 412 presentation_frames_.erase(render_frame_host_id); | 484 presentation_frames_.erase(render_frame_host_id); |
| 413 } | 485 } |
| 414 } | 486 } |
| 415 | 487 |
| 488 void PresentationFrameManager::AddDefaultPresentationRequestObserver( |
| 489 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver* |
| 490 observer) { |
| 491 default_presentation_request_observers_.AddObserver(observer); |
| 492 } |
| 493 |
| 494 void PresentationFrameManager::RemoveDefaultPresentationRequestObserver( |
| 495 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver* |
| 496 observer) { |
| 497 default_presentation_request_observers_.RemoveObserver(observer); |
| 498 } |
| 499 |
| 416 void PresentationFrameManager::Reset( | 500 void PresentationFrameManager::Reset( |
| 417 const RenderFrameHostId& render_frame_host_id) { | 501 const RenderFrameHostId& render_frame_host_id) { |
| 418 auto presentation_frame = presentation_frames_.get(render_frame_host_id); | 502 auto presentation_frame = presentation_frames_.get(render_frame_host_id); |
| 419 if (presentation_frame) | 503 if (presentation_frame) |
| 420 presentation_frame->Reset(); | 504 presentation_frame->Reset(); |
| 505 |
| 506 if (default_presentation_request_ && |
| 507 render_frame_host_id == |
| 508 default_presentation_request_->render_frame_host_id()) { |
| 509 ClearDefaultPresentationRequest(); |
| 510 } |
| 421 } | 511 } |
| 422 | 512 |
| 423 PresentationFrame* PresentationFrameManager::GetOrAddPresentationFrame( | 513 PresentationFrame* PresentationFrameManager::GetOrAddPresentationFrame( |
| 424 const RenderFrameHostId& render_frame_host_id) { | 514 const RenderFrameHostId& render_frame_host_id) { |
| 425 if (!presentation_frames_.contains(render_frame_host_id)) { | 515 if (!presentation_frames_.contains(render_frame_host_id)) { |
| 426 presentation_frames_.add( | 516 presentation_frames_.add( |
| 427 render_frame_host_id, | 517 render_frame_host_id, |
| 428 scoped_ptr<PresentationFrame>( | 518 scoped_ptr<PresentationFrame>( |
| 429 new PresentationFrame(web_contents_, router_))); | 519 new PresentationFrame(web_contents_, router_))); |
| 430 } | 520 } |
| 431 return presentation_frames_.get(render_frame_host_id); | 521 return presentation_frames_.get(render_frame_host_id); |
| 432 } | 522 } |
| 433 | 523 |
| 524 void PresentationFrameManager::ClearDefaultPresentationRequest() { |
| 525 default_presentation_started_callback_.Reset(); |
| 526 if (!default_presentation_request_) |
| 527 return; |
| 528 |
| 529 default_presentation_request_.reset(); |
| 530 FOR_EACH_OBSERVER( |
| 531 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver, |
| 532 default_presentation_request_observers_, OnDefaultPresentationRemoved()); |
| 533 } |
| 534 |
| 535 bool PresentationFrameManager::IsMainFrame( |
| 536 const RenderFrameHostId& render_frame_host_id) const { |
| 537 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); |
| 538 return main_frame && GetRenderFrameHostId(main_frame) == render_frame_host_id; |
| 539 } |
| 540 |
| 541 void PresentationFrameManager::SetDefaultPresentationRequest( |
| 542 const PresentationRequest& default_presentation_request) { |
| 543 if (default_presentation_request_ && |
| 544 default_presentation_request_->Equals(default_presentation_request)) |
| 545 return; |
| 546 |
| 547 default_presentation_request_.reset( |
| 548 new PresentationRequest(default_presentation_request)); |
| 549 FOR_EACH_OBSERVER( |
| 550 PresentationServiceDelegateImpl::DefaultPresentationRequestObserver, |
| 551 default_presentation_request_observers_, |
| 552 OnDefaultPresentationChanged(*default_presentation_request_)); |
| 553 } |
| 554 |
| 434 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) { | 555 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) { |
| 435 router_ = router; | 556 router_ = router; |
| 436 } | 557 } |
| 437 | 558 |
| 438 PresentationServiceDelegateImpl* | 559 PresentationServiceDelegateImpl* |
| 439 PresentationServiceDelegateImpl::GetOrCreateForWebContents( | 560 PresentationServiceDelegateImpl::GetOrCreateForWebContents( |
| 440 content::WebContents* web_contents) { | 561 content::WebContents* web_contents) { |
| 441 DCHECK(web_contents); | 562 DCHECK(web_contents); |
| 442 // CreateForWebContents does nothing if the delegate instance already exists. | 563 // CreateForWebContents does nothing if the delegate instance already exists. |
| 443 PresentationServiceDelegateImpl::CreateForWebContents(web_contents); | 564 PresentationServiceDelegateImpl::CreateForWebContents(web_contents); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 content::PresentationScreenAvailabilityListener* listener) { | 608 content::PresentationScreenAvailabilityListener* listener) { |
| 488 DCHECK(listener); | 609 DCHECK(listener); |
| 489 frame_manager_->RemoveScreenAvailabilityListener( | 610 frame_manager_->RemoveScreenAvailabilityListener( |
| 490 RenderFrameHostId(render_process_id, render_frame_id), listener); | 611 RenderFrameHostId(render_process_id, render_frame_id), listener); |
| 491 } | 612 } |
| 492 | 613 |
| 493 void PresentationServiceDelegateImpl::Reset(int render_process_id, | 614 void PresentationServiceDelegateImpl::Reset(int render_process_id, |
| 494 int render_frame_id) { | 615 int render_frame_id) { |
| 495 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); | 616 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
| 496 frame_manager_->Reset(render_frame_host_id); | 617 frame_manager_->Reset(render_frame_host_id); |
| 497 if (render_frame_host_id == default_presentation_render_frame_host_id_) { | |
| 498 UpdateDefaultMediaSourceAndNotifyObservers(RenderFrameHostId(), | |
| 499 MediaSource(), GURL()); | |
| 500 } | |
| 501 } | 618 } |
| 502 | 619 |
| 503 void PresentationServiceDelegateImpl::SetDefaultPresentationUrl( | 620 void PresentationServiceDelegateImpl::SetDefaultPresentationUrl( |
| 504 int render_process_id, | 621 int render_process_id, |
| 505 int render_frame_id, | 622 int render_frame_id, |
| 506 const std::string& default_presentation_url) { | 623 const std::string& default_presentation_url, |
| 624 const content::PresentationSessionStartedCallback& callback) { |
| 507 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); | 625 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
| 508 if (IsMainFrame(render_process_id, render_frame_id)) { | 626 frame_manager_->SetDefaultPresentationUrl(render_frame_host_id, |
| 509 // This is the main frame, which means tab-level default presentation | 627 default_presentation_url, callback); |
| 510 // might have been updated. | |
| 511 MediaSource default_source; | |
| 512 if (!default_presentation_url.empty()) | |
| 513 default_source = MediaSourceForPresentationUrl(default_presentation_url); | |
| 514 | |
| 515 GURL default_frame_url = GetLastCommittedURLForFrame(render_frame_host_id); | |
| 516 UpdateDefaultMediaSourceAndNotifyObservers( | |
| 517 render_frame_host_id, default_source, default_frame_url); | |
| 518 } | |
| 519 } | |
| 520 | |
| 521 bool PresentationServiceDelegateImpl::IsMainFrame(int render_process_id, | |
| 522 int render_frame_id) const { | |
| 523 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); | |
| 524 return main_frame && | |
| 525 GetRenderFrameHostId(main_frame) == | |
| 526 RenderFrameHostId(render_process_id, render_frame_id); | |
| 527 } | |
| 528 | |
| 529 void PresentationServiceDelegateImpl:: | |
| 530 UpdateDefaultMediaSourceAndNotifyObservers( | |
| 531 const RenderFrameHostId& render_frame_host_id, | |
| 532 const MediaSource& new_default_source, | |
| 533 const GURL& new_default_frame_url) { | |
| 534 default_presentation_render_frame_host_id_ = render_frame_host_id; | |
| 535 if (!new_default_source.Equals(default_source_) || | |
| 536 new_default_frame_url != default_frame_url_) { | |
| 537 default_source_ = new_default_source; | |
| 538 default_frame_url_ = new_default_frame_url; | |
| 539 FOR_EACH_OBSERVER( | |
| 540 DefaultMediaSourceObserver, default_media_source_observers_, | |
| 541 OnDefaultMediaSourceChanged(default_source_, default_frame_url_)); | |
| 542 } | |
| 543 } | 628 } |
| 544 | 629 |
| 545 void PresentationServiceDelegateImpl::OnJoinRouteResponse( | 630 void PresentationServiceDelegateImpl::OnJoinRouteResponse( |
| 546 int render_process_id, | 631 int render_process_id, |
| 547 int render_frame_id, | 632 int render_frame_id, |
| 548 const content::PresentationSessionInfo& session, | 633 const content::PresentationSessionInfo& session, |
| 549 const PresentationSessionSuccessCallback& success_cb, | 634 const content::PresentationSessionStartedCallback& success_cb, |
| 550 const PresentationSessionErrorCallback& error_cb, | 635 const content::PresentationSessionErrorCallback& error_cb, |
| 551 const MediaRoute* route, | 636 const MediaRoute* route, |
| 552 const std::string& presentation_id, | 637 const std::string& presentation_id, |
| 553 const std::string& error_text) { | 638 const std::string& error_text) { |
| 554 if (!route) { | 639 if (!route) { |
| 555 error_cb.Run(content::PresentationError( | 640 error_cb.Run(content::PresentationError( |
| 556 content::PRESENTATION_ERROR_NO_PRESENTATION_FOUND, error_text)); | 641 content::PRESENTATION_ERROR_NO_PRESENTATION_FOUND, error_text)); |
| 557 } else { | 642 } else { |
| 558 DVLOG(1) << "OnJoinRouteResponse: " | 643 DVLOG(1) << "OnJoinRouteResponse: " |
| 559 << "route_id: " << route->media_route_id() | 644 << "route_id: " << route->media_route_id() |
| 560 << ", presentation URL: " << session.presentation_url | 645 << ", presentation URL: " << session.presentation_url |
| 561 << ", presentation ID: " << session.presentation_id; | 646 << ", presentation ID: " << session.presentation_id; |
| 562 DCHECK_EQ(session.presentation_id, presentation_id); | 647 DCHECK_EQ(session.presentation_id, presentation_id); |
| 563 frame_manager_->OnPresentationSessionStarted( | 648 frame_manager_->OnPresentationSessionStarted( |
| 564 RenderFrameHostId(render_process_id, render_frame_id), false, session, | 649 RenderFrameHostId(render_process_id, render_frame_id), session, |
| 565 route->media_route_id()); | 650 route->media_route_id()); |
| 566 success_cb.Run(session); | 651 success_cb.Run(session); |
| 567 } | 652 } |
| 568 } | 653 } |
| 569 | 654 |
| 570 void PresentationServiceDelegateImpl::OnStartSessionSucceeded( | 655 void PresentationServiceDelegateImpl::OnStartSessionSucceeded( |
| 571 int render_process_id, | 656 int render_process_id, |
| 572 int render_frame_id, | 657 int render_frame_id, |
| 573 const PresentationSessionSuccessCallback& success_cb, | 658 const content::PresentationSessionStartedCallback& success_cb, |
| 574 const content::PresentationSessionInfo& new_session, | 659 const content::PresentationSessionInfo& new_session, |
| 575 const MediaRoute::Id& route_id) { | 660 const MediaRoute::Id& route_id) { |
| 576 DVLOG(1) << "OnStartSessionSucceeded: " | 661 DVLOG(1) << "OnStartSessionSucceeded: " |
| 577 << "route_id: " << route_id | 662 << "route_id: " << route_id |
| 578 << ", presentation URL: " << new_session.presentation_url | 663 << ", presentation URL: " << new_session.presentation_url |
| 579 << ", presentation ID: " << new_session.presentation_id; | 664 << ", presentation ID: " << new_session.presentation_id; |
| 580 frame_manager_->OnPresentationSessionStarted( | 665 frame_manager_->OnPresentationSessionStarted( |
| 581 RenderFrameHostId(render_process_id, render_frame_id), false, new_session, | 666 RenderFrameHostId(render_process_id, render_frame_id), new_session, |
| 582 route_id); | 667 route_id); |
| 583 success_cb.Run(new_session); | 668 success_cb.Run(new_session); |
| 584 } | 669 } |
| 585 | 670 |
| 586 void PresentationServiceDelegateImpl::StartSession( | 671 void PresentationServiceDelegateImpl::StartSession( |
| 587 int render_process_id, | 672 int render_process_id, |
| 588 int render_frame_id, | 673 int render_frame_id, |
| 589 const std::string& presentation_url, | 674 const std::string& presentation_url, |
| 590 const PresentationSessionSuccessCallback& success_cb, | 675 const content::PresentationSessionStartedCallback& success_cb, |
| 591 const PresentationSessionErrorCallback& error_cb) { | 676 const content::PresentationSessionErrorCallback& error_cb) { |
| 592 if (presentation_url.empty() || !IsValidPresentationUrl(presentation_url)) { | 677 if (presentation_url.empty() || !IsValidPresentationUrl(presentation_url)) { |
| 593 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, | 678 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, |
| 594 "Invalid presentation arguments.")); | 679 "Invalid presentation arguments.")); |
| 595 return; | 680 return; |
| 596 } | 681 } |
| 682 |
| 597 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); | 683 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
| 598 | 684 scoped_ptr<CreatePresentationConnectionRequest> request( |
| 599 scoped_ptr<CreatePresentationSessionRequest> context( | 685 new CreatePresentationConnectionRequest( |
| 600 new CreatePresentationSessionRequest( | 686 render_frame_host_id, presentation_url, |
| 601 presentation_url, GetLastCommittedURLForFrame(render_frame_host_id), | 687 GetLastCommittedURLForFrame(render_frame_host_id), |
| 602 base::Bind(&PresentationServiceDelegateImpl::OnStartSessionSucceeded, | 688 base::Bind(&PresentationServiceDelegateImpl::OnStartSessionSucceeded, |
| 603 weak_factory_.GetWeakPtr(), render_process_id, | 689 weak_factory_.GetWeakPtr(), render_process_id, |
| 604 render_frame_id, success_cb), | 690 render_frame_id, success_cb), |
| 605 error_cb)); | 691 error_cb)); |
| 606 MediaRouterDialogController* controller = | 692 MediaRouterDialogController* controller = |
| 607 MediaRouterDialogController::GetOrCreateForWebContents(web_contents_); | 693 MediaRouterDialogController::GetOrCreateForWebContents(web_contents_); |
| 608 if (!controller->ShowMediaRouterDialogForPresentation(context.Pass())) { | 694 if (!controller->ShowMediaRouterDialogForPresentation(request.Pass())) { |
| 609 LOG(ERROR) << "Media router dialog already exists. Ignoring StartSession."; | 695 LOG(ERROR) << "Media router dialog already exists. Ignoring StartSession."; |
| 610 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, | 696 error_cb.Run(content::PresentationError(content::PRESENTATION_ERROR_UNKNOWN, |
| 611 "Unable to create dialog.")); | 697 "Unable to create dialog.")); |
| 612 return; | 698 return; |
| 613 } | 699 } |
| 614 } | 700 } |
| 615 | 701 |
| 616 void PresentationServiceDelegateImpl::JoinSession( | 702 void PresentationServiceDelegateImpl::JoinSession( |
| 617 int render_process_id, | 703 int render_process_id, |
| 618 int render_frame_id, | 704 int render_frame_id, |
| 619 const std::string& presentation_url, | 705 const std::string& presentation_url, |
| 620 const std::string& presentation_id, | 706 const std::string& presentation_id, |
| 621 const PresentationSessionSuccessCallback& success_cb, | 707 const content::PresentationSessionStartedCallback& success_cb, |
| 622 const PresentationSessionErrorCallback& error_cb) { | 708 const content::PresentationSessionErrorCallback& error_cb) { |
| 623 std::vector<MediaRouteResponseCallback> route_response_callbacks; | 709 std::vector<MediaRouteResponseCallback> route_response_callbacks; |
| 624 route_response_callbacks.push_back(base::Bind( | 710 route_response_callbacks.push_back(base::Bind( |
| 625 &PresentationServiceDelegateImpl::OnJoinRouteResponse, | 711 &PresentationServiceDelegateImpl::OnJoinRouteResponse, |
| 626 weak_factory_.GetWeakPtr(), render_process_id, render_frame_id, | 712 weak_factory_.GetWeakPtr(), render_process_id, render_frame_id, |
| 627 content::PresentationSessionInfo(presentation_url, presentation_id), | 713 content::PresentationSessionInfo(presentation_url, presentation_id), |
| 628 success_cb, error_cb)); | 714 success_cb, error_cb)); |
| 629 router_->JoinRoute( | 715 router_->JoinRoute( |
| 630 MediaSourceForPresentationUrl(presentation_url).id(), presentation_id, | 716 MediaSourceForPresentationUrl(presentation_url).id(), presentation_id, |
| 631 GetLastCommittedURLForFrame( | 717 GetLastCommittedURLForFrame( |
| 632 RenderFrameHostId(render_process_id, render_frame_id)) | 718 RenderFrameHostId(render_process_id, render_frame_id)) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 768 |
| 683 void PresentationServiceDelegateImpl::ListenForSessionStateChange( | 769 void PresentationServiceDelegateImpl::ListenForSessionStateChange( |
| 684 int render_process_id, | 770 int render_process_id, |
| 685 int render_frame_id, | 771 int render_frame_id, |
| 686 const content::SessionStateChangedCallback& state_changed_cb) { | 772 const content::SessionStateChangedCallback& state_changed_cb) { |
| 687 frame_manager_->ListenForSessionStateChange( | 773 frame_manager_->ListenForSessionStateChange( |
| 688 RenderFrameHostId(render_process_id, render_frame_id), state_changed_cb); | 774 RenderFrameHostId(render_process_id, render_frame_id), state_changed_cb); |
| 689 } | 775 } |
| 690 | 776 |
| 691 void PresentationServiceDelegateImpl::OnRouteResponse( | 777 void PresentationServiceDelegateImpl::OnRouteResponse( |
| 778 const PresentationRequest& presentation_request, |
| 692 const MediaRoute* route, | 779 const MediaRoute* route, |
| 693 const std::string& presentation_id, | 780 const std::string& presentation_id, |
| 694 const std::string& error) { | 781 const std::string& error) { |
| 695 if (!route) | 782 if (!route) |
| 696 return; | 783 return; |
| 697 const MediaSource& source = route->media_source(); | 784 |
| 698 DCHECK(!source.Empty()); | 785 content::PresentationSessionInfo session_info( |
| 699 if (!default_source_.Equals(source)) | 786 presentation_request.presentation_url(), presentation_id); |
| 700 return; | 787 frame_manager_->OnDefaultPresentationSessionStarted( |
| 701 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); | 788 presentation_request, session_info, route->media_route_id()); |
| 702 if (!main_frame) | |
| 703 return; | |
| 704 RenderFrameHostId render_frame_host_id(GetRenderFrameHostId(main_frame)); | |
| 705 frame_manager_->OnPresentationSessionStarted( | |
| 706 render_frame_host_id, true, | |
| 707 content::PresentationSessionInfo(PresentationUrlFromMediaSource(source), | |
| 708 presentation_id), | |
| 709 route->media_route_id()); | |
| 710 } | 789 } |
| 711 | 790 |
| 712 void PresentationServiceDelegateImpl::AddDefaultMediaSourceObserver( | 791 void PresentationServiceDelegateImpl::AddDefaultPresentationRequestObserver( |
| 713 DefaultMediaSourceObserver* observer) { | 792 DefaultPresentationRequestObserver* observer) { |
| 714 default_media_source_observers_.AddObserver(observer); | 793 frame_manager_->AddDefaultPresentationRequestObserver(observer); |
| 715 } | 794 } |
| 716 | 795 |
| 717 void PresentationServiceDelegateImpl::RemoveDefaultMediaSourceObserver( | 796 void PresentationServiceDelegateImpl::RemoveDefaultPresentationRequestObserver( |
| 718 DefaultMediaSourceObserver* observer) { | 797 DefaultPresentationRequestObserver* observer) { |
| 719 default_media_source_observers_.RemoveObserver(observer); | 798 frame_manager_->RemoveDefaultPresentationRequestObserver(observer); |
| 799 } |
| 800 |
| 801 PresentationRequest |
| 802 PresentationServiceDelegateImpl::GetDefaultPresentationRequest() const { |
| 803 DCHECK(HasDefaultPresentationRequest()); |
| 804 return *frame_manager_->default_presentation_request(); |
| 805 } |
| 806 |
| 807 bool PresentationServiceDelegateImpl::HasDefaultPresentationRequest() const { |
| 808 return frame_manager_->default_presentation_request() != nullptr; |
| 720 } | 809 } |
| 721 | 810 |
| 722 base::WeakPtr<PresentationServiceDelegateImpl> | 811 base::WeakPtr<PresentationServiceDelegateImpl> |
| 723 PresentationServiceDelegateImpl::GetWeakPtr() { | 812 PresentationServiceDelegateImpl::GetWeakPtr() { |
| 724 return weak_factory_.GetWeakPtr(); | 813 return weak_factory_.GetWeakPtr(); |
| 725 } | 814 } |
| 726 | 815 |
| 727 void PresentationServiceDelegateImpl::SetMediaRouterForTest( | 816 void PresentationServiceDelegateImpl::SetMediaRouterForTest( |
| 728 MediaRouter* router) { | 817 MediaRouter* router) { |
| 729 router_ = router; | 818 router_ = router; |
| 730 frame_manager_->SetMediaRouterForTest(router); | 819 frame_manager_->SetMediaRouterForTest(router); |
| 731 } | 820 } |
| 732 | 821 |
| 733 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( | 822 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( |
| 734 int render_process_id, | 823 int render_process_id, |
| 735 int render_frame_id, | 824 int render_frame_id, |
| 736 const MediaSource::Id& source_id) const { | 825 const MediaSource::Id& source_id) const { |
| 737 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); | 826 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
| 738 return frame_manager_->HasScreenAvailabilityListenerForTest( | 827 return frame_manager_->HasScreenAvailabilityListenerForTest( |
| 739 render_frame_host_id, source_id); | 828 render_frame_host_id, source_id); |
| 740 } | 829 } |
| 741 | 830 |
| 742 } // namespace media_router | 831 } // namespace media_router |
| OLD | NEW |