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