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

Side by Side Diff: chrome/browser/media/router/presentation_service_delegate_impl.cc

Issue 1314413005: [Presentation API] 1-UA presentation support + presenter APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed yuri's comments #16 Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/media/router/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/scoped_ptr_map.h" 10 #include "base/containers/scoped_ptr_map.h"
11 #include "base/containers/small_map.h" 11 #include "base/containers/small_map.h"
12 #include "base/guid.h"
13 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
15 #include "chrome/browser/media/router/create_presentation_session_request.h" 14 #include "chrome/browser/media/router/create_presentation_session_request.h"
16 #include "chrome/browser/media/router/media_route.h" 15 #include "chrome/browser/media/router/media_route.h"
17 #include "chrome/browser/media/router/media_router.h" 16 #include "chrome/browser/media/router/media_router.h"
18 #include "chrome/browser/media/router/media_router_dialog_controller.h" 17 #include "chrome/browser/media/router/media_router_dialog_controller.h"
19 #include "chrome/browser/media/router/media_router_factory.h" 18 #include "chrome/browser/media/router/media_router_factory.h"
20 #include "chrome/browser/media/router/media_sink.h" 19 #include "chrome/browser/media/router/media_sink.h"
21 #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/offscreen_presentation_manager.h"
22 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h"
22 #include "chrome/browser/media/router/presentation_media_sinks_observer.h" 23 #include "chrome/browser/media/router/presentation_media_sinks_observer.h"
23 #include "chrome/browser/media/router/presentation_session_messages_observer.h" 24 #include "chrome/browser/media/router/presentation_session_messages_observer.h"
24 #include "chrome/browser/media/router/presentation_session_state_observer.h" 25 #include "chrome/browser/media/router/presentation_session_state_observer.h"
25 #include "chrome/browser/sessions/session_tab_helper.h" 26 #include "chrome/browser/sessions/session_tab_helper.h"
26 #include "content/public/browser/presentation_screen_availability_listener.h" 27 #include "content/public/browser/presentation_screen_availability_listener.h"
27 #include "content/public/browser/presentation_session.h" 28 #include "content/public/browser/presentation_session.h"
28 #include "content/public/browser/presentation_session_state_listener.h" 29 #include "content/public/browser/presentation_session_state_listener.h"
29 #include "content/public/browser/render_frame_host.h" 30 #include "content/public/browser/render_frame_host.h"
30 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
31 32
32 DEFINE_WEB_CONTENTS_USER_DATA_KEY( 33 DEFINE_WEB_CONTENTS_USER_DATA_KEY(
33 media_router::PresentationServiceDelegateImpl); 34 media_router::PresentationServiceDelegateImpl);
34 35
35 using content::RenderFrameHost; 36 using content::RenderFrameHost;
36 37
37 namespace media_router { 38 namespace media_router {
38 39
40 using OffscreenPresentationSession =
41 OffscreenPresentationManager::OffscreenPresentationSession;
42
39 namespace { 43 namespace {
40 44
41 using DelegateObserver = content::PresentationServiceDelegate::Observer; 45 using DelegateObserver = content::PresentationServiceDelegate::Observer;
42 using PresentationSessionErrorCallback = 46 using PresentationSessionErrorCallback =
43 content::PresentationServiceDelegate::PresentationSessionErrorCallback; 47 content::PresentationServiceDelegate::PresentationSessionErrorCallback;
44 using PresentationSessionSuccessCallback = 48 using PresentationSessionSuccessCallback =
45 content::PresentationServiceDelegate::PresentationSessionSuccessCallback; 49 content::PresentationServiceDelegate::PresentationSessionSuccessCallback;
46 50
47 // Returns the unique identifier for the supplied RenderFrameHost. 51 // Returns the unique identifier for the supplied RenderFrameHost.
48 RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) { 52 RenderFrameHostId GetRenderFrameHostId(RenderFrameHost* render_frame_host) {
(...skipping 14 matching lines...) Expand all
63 } // namespace 67 } // namespace
64 68
65 // Used by PresentationServiceDelegateImpl to manage 69 // Used by PresentationServiceDelegateImpl to manage
66 // listeners and default presentation info in a render frame. 70 // listeners and default presentation info in a render frame.
67 // Its lifetime: 71 // Its lifetime:
68 // * PresentationFrameManager AddDelegateObserver 72 // * PresentationFrameManager AddDelegateObserver
69 // * Reset 0+ times. 73 // * Reset 0+ times.
70 // * PresentationFrameManager.RemoveDelegateObserver. 74 // * PresentationFrameManager.RemoveDelegateObserver.
71 class PresentationFrame { 75 class PresentationFrame {
72 public: 76 public:
73 PresentationFrame(content::WebContents* web_contents, MediaRouter* router); 77 PresentationFrame(content::WebContents* web_contents,
78 const RenderFrameHostId& render_frame_host_id,
79 MediaRouter* router);
74 ~PresentationFrame(); 80 ~PresentationFrame();
75 81
76 // Mirror corresponding APIs in PresentationServiceDelegateImpl. 82 // Mirror corresponding APIs in PresentationServiceDelegateImpl.
77 bool SetScreenAvailabilityListener( 83 bool SetScreenAvailabilityListener(
78 content::PresentationScreenAvailabilityListener* listener); 84 content::PresentationScreenAvailabilityListener* listener);
79 bool RemoveScreenAvailabilityListener( 85 bool RemoveScreenAvailabilityListener(
80 content::PresentationScreenAvailabilityListener* listener); 86 content::PresentationScreenAvailabilityListener* listener);
81 bool HasScreenAvailabilityListenerForTest( 87 bool HasScreenAvailabilityListenerForTest(
82 const MediaSource::Id& source_id) const; 88 const MediaSource::Id& source_id) const;
83 std::string GetDefaultPresentationId() const; 89 std::string GetDefaultPresentationId() const;
90 void SendMessage(const content::PresentationSessionInfo& session,
91 scoped_ptr<content::PresentationSessionMessage> message,
92 const content::SendMessageCallback send_message_cb);
84 bool ListenForSessionStateChange( 93 bool ListenForSessionStateChange(
85 content::PresentationSessionStateListener* listener); 94 content::PresentationSessionStateListener* listener);
86 void ListenForSessionMessages( 95 void ListenForSessionMessages(
87 const content::PresentationSessionInfo& session, 96 const content::PresentationSessionInfo& session,
88 const content::PresentationSessionMessageCallback& message_cb); 97 const content::PresentationSessionMessageCallback& message_cb);
89 void Reset(); 98 void Reset();
90 99
91 const MediaRoute::Id GetRouteId(const std::string& presentation_id) const; 100 const MediaRoute::Id GetRouteId(const std::string& presentation_id) const;
92 const std::vector<MediaRoute::Id> GetRouteIds() const;
93 void OnPresentationSessionClosed(const std::string& presentation_id); 101 void OnPresentationSessionClosed(const std::string& presentation_id);
94 102
95 void OnPresentationSessionStarted( 103 void OnPresentationSessionStarted(
96 bool is_default_presentation, 104 bool is_default_presentation,
97 const content::PresentationSessionInfo& session, 105 const content::PresentationSessionInfo& session,
98 const MediaRoute::Id& route_id); 106 const MediaRoute& route);
99 void OnPresentationServiceDelegateDestroyed() const; 107 void OnPresentationServiceDelegateDestroyed() const;
100 108
101 void set_delegate_observer(DelegateObserver* observer) { 109 void set_delegate_observer(DelegateObserver* observer) {
102 delegate_observer_ = observer; 110 delegate_observer_ = observer;
103 } 111 }
104 112
105 private: 113 private:
106 MediaSource GetMediaSourceFromListener( 114 MediaSource GetMediaSourceFromListener(
107 content::PresentationScreenAvailabilityListener* listener) const; 115 content::PresentationScreenAvailabilityListener* listener) const;
116
117 // Gets the OffscreenPresentationSession associated with |presentation_id|
118 // within this frame. Returns nullptr if |presentation_id| is not
119 // registered as an offscreen presentation.
120 OffscreenPresentationSession* FindOffscreenSession(
121 const std::string& presentation_id) const;
122
108 base::SmallMap<std::map<std::string, MediaRoute::Id>> 123 base::SmallMap<std::map<std::string, MediaRoute::Id>>
109 presentation_id_to_route_id_; 124 presentation_id_to_route_id_;
110 scoped_ptr<PresentationMediaSinksObserver> sinks_observer_; 125 scoped_ptr<PresentationMediaSinksObserver> sinks_observer_;
111 126
127 // Controller objects for offscreen presentations. Note that offscreen
128 // presentations are manipulated with these objects instead of the observers
129 // and MediaRouter objects below.
130 // Maps from presentation ID to the corresponding OffscreenController within
mark a. foltz 2015/10/12 21:56:10 Can this paragraph be wrapped?
imcheng 2015/10/17 01:00:24 Done.
131 // this frame.
132 base::ScopedPtrMap<std::string, scoped_ptr<OffscreenPresentationSession>>
133 offscreen_presentation_sessions_;
134
135 // For non-offscreen presentations.
112 // Maps from presentation ID to the corresponding presentation session's 136 // Maps from presentation ID to the corresponding presentation session's
113 // state change observer within this frame. 137 // state change observer within this frame.
114 base::ScopedPtrMap<std::string, scoped_ptr<PresentationSessionStateObserver>> 138 base::ScopedPtrMap<std::string, scoped_ptr<PresentationSessionStateObserver>>
115 session_state_observers_; 139 session_state_observers_;
116 ScopedVector<PresentationSessionMessagesObserver> session_messages_observers_; 140 ScopedVector<PresentationSessionMessagesObserver> session_messages_observers_;
117 141
118 // References to the owning WebContents, and the corresponding MediaRouter. 142 // References to the owning WebContents.
119 const content::WebContents* web_contents_; 143 const content::WebContents* const web_contents_;
120 MediaRouter* router_; 144
145 // ID of owning RenderFrameHost.
146 const RenderFrameHostId render_frame_host_id_;
147
148 // References to MediaRouter / OffscreenPresentationManager owned by
149 // the associated BrowserContext. They (and the BrowserContext) are
150 // guaranteed to outlive this object.
151 MediaRouter* const router_;
152 OffscreenPresentationManager* const offscreen_presentation_manager_;
121 153
122 DelegateObserver* delegate_observer_; 154 DelegateObserver* delegate_observer_;
123 }; 155 };
124 156
125 PresentationFrame::PresentationFrame(content::WebContents* web_contents, 157 PresentationFrame::PresentationFrame(
126 MediaRouter* router) 158 content::WebContents* web_contents,
159 const RenderFrameHostId& render_frame_host_id,
160 MediaRouter* router)
127 : web_contents_(web_contents), 161 : web_contents_(web_contents),
162 render_frame_host_id_(render_frame_host_id),
128 router_(router), 163 router_(router),
164 offscreen_presentation_manager_(
165 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext(
166 web_contents_->GetBrowserContext())),
129 delegate_observer_(nullptr) { 167 delegate_observer_(nullptr) {
130 DCHECK(web_contents_); 168 DCHECK(web_contents_);
131 DCHECK(router_); 169 DCHECK(router_);
170 DCHECK(offscreen_presentation_manager_);
132 } 171 }
133 172
134 PresentationFrame::~PresentationFrame() { 173 PresentationFrame::~PresentationFrame() {
135 } 174 }
136 175
137 void PresentationFrame::OnPresentationServiceDelegateDestroyed() const { 176 void PresentationFrame::OnPresentationServiceDelegateDestroyed() const {
138 if (delegate_observer_) 177 if (delegate_observer_)
139 delegate_observer_->OnDelegateDestroyed(); 178 delegate_observer_->OnDelegateDestroyed();
140 } 179 }
141 180
142 void PresentationFrame::OnPresentationSessionStarted( 181 void PresentationFrame::OnPresentationSessionStarted(
143 bool is_default_presentation, 182 bool is_default_presentation,
144 const content::PresentationSessionInfo& session, 183 const content::PresentationSessionInfo& session,
145 const MediaRoute::Id& route_id) { 184 const MediaRoute& route) {
146 presentation_id_to_route_id_[session.presentation_id] = route_id; 185 const std::string& presentation_id = session.presentation_id;
186 presentation_id_to_route_id_[presentation_id] = route.media_route_id();
147 if (is_default_presentation && delegate_observer_) 187 if (is_default_presentation && delegate_observer_)
148 delegate_observer_->OnDefaultPresentationStarted(session); 188 delegate_observer_->OnDefaultPresentationStarted(session);
189 if (route.is_offscreen_presentation()) {
190 DCHECK(!ContainsKey(offscreen_presentation_sessions_, presentation_id));
mark a. foltz 2015/10/12 21:56:10 Behavior in release builds?
imcheng 2015/10/17 01:00:24 Changed ConnectToOffscreenPresentation to return n
191 scoped_ptr<OffscreenPresentationSession> offscreen_session =
192 offscreen_presentation_manager_->ConnectToOffscreenPresentation(
193 presentation_id, render_frame_host_id_);
194
195 // If |offscreen_session| is nullptr, then the receiver is most likely
196 // already gone, so the route will die soon. This should happen very rarely
197 // since the receiver has to unregister itself between when offscreen
198 // presentation was created and when the resulting route arrived at MR.
199 if (!offscreen_session) {
200 // TODO(imcheng): we should probably reject the route request in this
201 // case. crbug.com/513859
202 DLOG(ERROR) << "CreateOffscreenPresentationConnection returned nullptr.";
203 } else {
204 offscreen_presentation_sessions_.insert(presentation_id,
205 offscreen_session.Pass());
206 }
207 }
149 } 208 }
150 209
151 void PresentationFrame::OnPresentationSessionClosed( 210 void PresentationFrame::OnPresentationSessionClosed(
152 const std::string& presentation_id) { 211 const std::string& presentation_id) {
153 auto it = presentation_id_to_route_id_.find(presentation_id); 212 auto it = presentation_id_to_route_id_.find(presentation_id);
154 if (it != presentation_id_to_route_id_.end()) { 213 if (it != presentation_id_to_route_id_.end()) {
155 presentation_id_to_route_id_.erase(it); 214 presentation_id_to_route_id_.erase(it);
156 } 215 }
157 // TODO(imcheng): Notify PresentationSessionStateObserver? 216 // TODO(imcheng): Notify PresentationSessionStateObserver?
158 } 217 }
159 218
160 const MediaRoute::Id PresentationFrame::GetRouteId( 219 const MediaRoute::Id PresentationFrame::GetRouteId(
161 const std::string& presentation_id) const { 220 const std::string& presentation_id) const {
162 auto it = presentation_id_to_route_id_.find(presentation_id); 221 auto it = presentation_id_to_route_id_.find(presentation_id);
163 return it != presentation_id_to_route_id_.end() ? it->second : ""; 222 return it != presentation_id_to_route_id_.end() ? it->second : "";
164 } 223 }
165 224
166 const std::vector<MediaRoute::Id> PresentationFrame::GetRouteIds() const {
167 std::vector<MediaRoute::Id> route_ids;
168 for (const auto& e : presentation_id_to_route_id_)
169 route_ids.push_back(e.second);
170 return route_ids;
171 }
172
173 bool PresentationFrame::SetScreenAvailabilityListener( 225 bool PresentationFrame::SetScreenAvailabilityListener(
174 content::PresentationScreenAvailabilityListener* listener) { 226 content::PresentationScreenAvailabilityListener* listener) {
175 if (sinks_observer_ && sinks_observer_->listener() == listener) 227 if (sinks_observer_ && sinks_observer_->listener() == listener)
176 return false; 228 return false;
177 229
178 MediaSource source(GetMediaSourceFromListener(listener)); 230 MediaSource source(GetMediaSourceFromListener(listener));
179 sinks_observer_.reset( 231 sinks_observer_.reset(
180 new PresentationMediaSinksObserver(router_, listener, source)); 232 new PresentationMediaSinksObserver(router_, listener, source));
181 233
182 if (!sinks_observer_->is_active()) { 234 if (!sinks_observer_->is_active()) {
(...skipping 18 matching lines...) Expand all
201 const MediaSource::Id& source_id) const { 253 const MediaSource::Id& source_id) const {
202 return sinks_observer_ && sinks_observer_->source().id() == source_id; 254 return sinks_observer_ && sinks_observer_->source().id() == source_id;
203 } 255 }
204 256
205 void PresentationFrame::Reset() { 257 void PresentationFrame::Reset() {
206 for (const auto& pid_route_id : presentation_id_to_route_id_) 258 for (const auto& pid_route_id : presentation_id_to_route_id_)
207 router_->OnPresentationSessionDetached(pid_route_id.second); 259 router_->OnPresentationSessionDetached(pid_route_id.second);
208 260
209 presentation_id_to_route_id_.clear(); 261 presentation_id_to_route_id_.clear();
210 sinks_observer_.reset(); 262 sinks_observer_.reset();
263 offscreen_presentation_sessions_.clear();
211 session_state_observers_.clear(); 264 session_state_observers_.clear();
212 session_messages_observers_.clear(); 265 session_messages_observers_.clear();
213 } 266 }
214 267
268 void PresentationFrame::SendMessage(
269 const content::PresentationSessionInfo& session,
270 scoped_ptr<content::PresentationSessionMessage> message,
271 const content::SendMessageCallback send_message_cb) {
272 auto it = presentation_id_to_route_id_.find(session.presentation_id);
mark a. foltz 2015/10/12 21:56:10 This lookup only really makes sense for 2-UA prese
imcheng 2015/10/17 01:00:24 Done. Also done similarly for below.
273 if (it == presentation_id_to_route_id_.end()) {
274 DVLOG(2) << "ListenForSessionMessages: no route for "
275 << session.presentation_id;
276 return;
277 }
278
279 OffscreenPresentationSession* offscreen_session =
280 FindOffscreenSession(session.presentation_id);
281 if (offscreen_session) {
282 offscreen_session->SendMessage(message.Pass(), send_message_cb);
283 } else {
284 if (message->is_binary()) {
285 router_->SendRouteBinaryMessage(it->second, message->data.Pass(),
286 send_message_cb);
287 } else {
288 router_->SendRouteMessage(it->second, message->message, send_message_cb);
289 }
290 }
291 }
292
293 OffscreenPresentationSession* PresentationFrame::FindOffscreenSession(
294 const std::string& presentation_id) const {
295 auto offscreen_session_it =
296 offscreen_presentation_sessions_.find(presentation_id);
297 return offscreen_session_it != offscreen_presentation_sessions_.end()
298 ? offscreen_session_it->second
299 : nullptr;
300 }
301
215 bool PresentationFrame::ListenForSessionStateChange( 302 bool PresentationFrame::ListenForSessionStateChange(
216 content::PresentationSessionStateListener* listener) { 303 content::PresentationSessionStateListener* listener) {
217 std::string presentation_id(listener->GetSessionInfo().presentation_id); 304 std::string presentation_id(listener->GetSessionInfo().presentation_id);
218 auto it = presentation_id_to_route_id_.find(presentation_id); 305 auto it = presentation_id_to_route_id_.find(presentation_id);
219 if (it == presentation_id_to_route_id_.end()) { 306 if (it == presentation_id_to_route_id_.end()) {
220 DVLOG(2) << "ListenForSessionStateChange: no route for " << presentation_id; 307 DVLOG(2) << "ListenForSessionStateChange: no route for " << presentation_id;
221 return false; 308 return false;
222 } 309 }
223 310
224 if (ContainsKey(session_state_observers_, presentation_id)) { 311 OffscreenPresentationSession* offscreen_session =
225 DVLOG(2) << "ListenForSessionStateChange: already contains a state " 312 FindOffscreenSession(presentation_id);
226 << "observer for session " << presentation_id; 313 if (offscreen_session) {
227 return false; 314 offscreen_session->ListenForStateChanges(listener);
315 return true;
316 } else {
whywhat 2015/10/13 15:21:31 nit: remove else
imcheng 2015/10/17 01:00:24 Done.
317 if (ContainsKey(session_state_observers_, presentation_id)) {
318 DVLOG(2) << "ListenForSessionStateChange: already contains a state "
319 << "observer for session " << presentation_id;
320 return false;
321 }
322
323 session_state_observers_.insert(
324 presentation_id, make_scoped_ptr(new PresentationSessionStateObserver(
325 listener, it->second, router_)));
326 return true;
228 } 327 }
229
230 session_state_observers_.insert(
231 presentation_id, make_scoped_ptr(new PresentationSessionStateObserver(
232 listener, it->second, router_)));
233 return true;
234 } 328 }
235 329
236 void PresentationFrame::ListenForSessionMessages( 330 void PresentationFrame::ListenForSessionMessages(
237 const content::PresentationSessionInfo& session, 331 const content::PresentationSessionInfo& session,
238 const content::PresentationSessionMessageCallback& message_cb) { 332 const content::PresentationSessionMessageCallback& message_cb) {
239 auto it = presentation_id_to_route_id_.find(session.presentation_id); 333 auto it = presentation_id_to_route_id_.find(session.presentation_id);
240 if (it == presentation_id_to_route_id_.end()) { 334 if (it == presentation_id_to_route_id_.end()) {
241 DVLOG(2) << "ListenForSessionMessages: no route for " 335 DVLOG(2) << "ListenForSessionMessages: no route for "
242 << session.presentation_id; 336 << session.presentation_id;
243 return; 337 return;
244 } 338 }
245 339
246 session_messages_observers_.push_back( 340 OffscreenPresentationSession* offscreen_session =
247 new PresentationSessionMessagesObserver(message_cb, it->second, router_)); 341 FindOffscreenSession(session.presentation_id);
342 if (offscreen_session) {
343 offscreen_session->ListenForMessages(message_cb);
344 } else {
345 session_messages_observers_.push_back(
346 new PresentationSessionMessagesObserver(message_cb, it->second,
347 router_));
348 }
248 } 349 }
249 350
250 MediaSource PresentationFrame::GetMediaSourceFromListener( 351 MediaSource PresentationFrame::GetMediaSourceFromListener(
251 content::PresentationScreenAvailabilityListener* listener) const { 352 content::PresentationScreenAvailabilityListener* listener) const {
252 // If the default presentation URL is empty then fall back to tab mirroring. 353 // If the default presentation URL is empty then fall back to tab mirroring.
253 std::string availability_url(listener->GetAvailabilityUrl()); 354 std::string availability_url(listener->GetAvailabilityUrl());
254 return availability_url.empty() 355 return availability_url.empty()
255 ? MediaSourceForTab(SessionTabHelper::IdForTab(web_contents_)) 356 ? MediaSourceForTab(SessionTabHelper::IdForTab(web_contents_))
256 : MediaSourceForPresentationUrl(availability_url); 357 : MediaSourceForPresentationUrl(availability_url);
257 } 358 }
258 359
259 // Used by PresentationServiceDelegateImpl to manage PresentationFrames. 360 // Used by PresentationServiceDelegateImpl to manage PresentationFrames.
260 class PresentationFrameManager { 361 class PresentationFrameManager {
261 public: 362 public:
262 PresentationFrameManager(content::WebContents* web_contents, 363 PresentationFrameManager(content::WebContents* web_contents,
263 MediaRouter* router); 364 MediaRouter* router);
264 ~PresentationFrameManager(); 365 ~PresentationFrameManager();
265 366
266 // Mirror corresponding APIs in PresentationServiceDelegateImpl. 367 // Mirror corresponding APIs in PresentationServiceDelegateImpl.
267 bool SetScreenAvailabilityListener( 368 bool SetScreenAvailabilityListener(
268 const RenderFrameHostId& render_frame_host_id, 369 const RenderFrameHostId& render_frame_host_id,
269 content::PresentationScreenAvailabilityListener* listener); 370 content::PresentationScreenAvailabilityListener* listener);
270 bool RemoveScreenAvailabilityListener( 371 bool RemoveScreenAvailabilityListener(
271 const RenderFrameHostId& render_frame_host_id, 372 const RenderFrameHostId& render_frame_host_id,
272 content::PresentationScreenAvailabilityListener* listener); 373 content::PresentationScreenAvailabilityListener* listener);
374 void SendMessage(const RenderFrameHostId& render_frame_host_id,
375 const content::PresentationSessionInfo& session,
376 scoped_ptr<content::PresentationSessionMessage> message,
377 const content::SendMessageCallback send_message_cb);
273 bool ListenForSessionStateChange( 378 bool ListenForSessionStateChange(
274 const RenderFrameHostId& render_frame_host_id, 379 const RenderFrameHostId& render_frame_host_id,
275 content::PresentationSessionStateListener* listener); 380 content::PresentationSessionStateListener* listener);
276 void ListenForSessionMessages( 381 void ListenForSessionMessages(
277 const RenderFrameHostId& render_frame_host_id, 382 const RenderFrameHostId& render_frame_host_id,
278 const content::PresentationSessionInfo& session, 383 const content::PresentationSessionInfo& session,
279 const content::PresentationSessionMessageCallback& message_cb); 384 const content::PresentationSessionMessageCallback& message_cb);
280 void AddDelegateObserver(const RenderFrameHostId& render_frame_host_id, 385 void AddDelegateObserver(const RenderFrameHostId& render_frame_host_id,
281 DelegateObserver* observer); 386 DelegateObserver* observer);
282 void RemoveDelegateObserver(const RenderFrameHostId& render_frame_host_id); 387 void RemoveDelegateObserver(const RenderFrameHostId& render_frame_host_id);
283 void Reset(const RenderFrameHostId& render_frame_host_id); 388 void Reset(const RenderFrameHostId& render_frame_host_id);
284 bool HasScreenAvailabilityListenerForTest( 389 bool HasScreenAvailabilityListenerForTest(
285 const RenderFrameHostId& render_frame_host_id, 390 const RenderFrameHostId& render_frame_host_id,
286 const MediaSource::Id& source_id) const; 391 const MediaSource::Id& source_id) const;
287 void SetMediaRouterForTest(MediaRouter* router); 392 void SetMediaRouterForTest(MediaRouter* router);
288 393
289 void OnPresentationSessionStarted( 394 void OnPresentationSessionStarted(
290 const RenderFrameHostId& render_frame_host_id, 395 const RenderFrameHostId& render_frame_host_id,
291 bool is_default_presentation, 396 bool is_default_presentation,
292 const content::PresentationSessionInfo& session, 397 const content::PresentationSessionInfo& session,
293 const MediaRoute::Id& route_id); 398 const MediaRoute& route);
294 399
295 void OnPresentationSessionClosed( 400 void OnPresentationSessionClosed(
296 const RenderFrameHostId& render_frame_host_id, 401 const RenderFrameHostId& render_frame_host_id,
297 const std::string& presentation_id); 402 const std::string& presentation_id);
298 const MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id, 403 const MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id,
299 const std::string& presentation_id) const; 404 const std::string& presentation_id) const;
300 const std::vector<MediaRoute::Id> GetRouteIds(
301 const RenderFrameHostId& render_frame_host_id) const;
302 405
303 private: 406 private:
304 PresentationFrame* GetOrAddPresentationFrame( 407 PresentationFrame* GetOrAddPresentationFrame(
305 const RenderFrameHostId& render_frame_host_id); 408 const RenderFrameHostId& render_frame_host_id);
306 409
307 // Maps a frame identifier to a PresentationFrame object for frames 410 // Maps a frame identifier to a PresentationFrame object for frames
308 // that are using presentation API. 411 // that are using presentation API.
309 base::ScopedPtrHashMap<RenderFrameHostId, scoped_ptr<PresentationFrame>> 412 base::ScopedPtrHashMap<RenderFrameHostId, scoped_ptr<PresentationFrame>>
310 presentation_frames_; 413 presentation_frames_;
311 414
312 // References to the owning WebContents, and the corresponding MediaRouter. 415 // References to the owning WebContents, and the corresponding MediaRouter.
416 content::WebContents* const web_contents_;
313 MediaRouter* router_; 417 MediaRouter* router_;
314 content::WebContents* web_contents_;
315 }; 418 };
316 419
317 PresentationFrameManager::PresentationFrameManager( 420 PresentationFrameManager::PresentationFrameManager(
318 content::WebContents* web_contents, 421 content::WebContents* web_contents,
319 MediaRouter* router) 422 MediaRouter* router)
320 : router_(router), web_contents_(web_contents) { 423 : web_contents_(web_contents), router_(router) {
321 DCHECK(web_contents_); 424 DCHECK(web_contents_);
322 DCHECK(router_); 425 DCHECK(router_);
323 } 426 }
324 427
325 PresentationFrameManager::~PresentationFrameManager() { 428 PresentationFrameManager::~PresentationFrameManager() {
326 for (auto& frame : presentation_frames_) 429 for (auto& frame : presentation_frames_)
327 frame.second->OnPresentationServiceDelegateDestroyed(); 430 frame.second->OnPresentationServiceDelegateDestroyed();
328 } 431 }
329 432
330 void PresentationFrameManager::OnPresentationSessionStarted( 433 void PresentationFrameManager::OnPresentationSessionStarted(
331 const RenderFrameHostId& render_frame_host_id, 434 const RenderFrameHostId& render_frame_host_id,
332 bool is_default_presentation, 435 bool is_default_presentation,
333 const content::PresentationSessionInfo& session, 436 const content::PresentationSessionInfo& session,
334 const MediaRoute::Id& route_id) { 437 const MediaRoute& route) {
335 auto presentation_frame = presentation_frames_.get(render_frame_host_id); 438 auto presentation_frame = presentation_frames_.get(render_frame_host_id);
336 if (presentation_frame) 439 if (presentation_frame) {
337 presentation_frame->OnPresentationSessionStarted(is_default_presentation, 440 presentation_frame->OnPresentationSessionStarted(is_default_presentation,
338 session, route_id); 441 session, route);
442 }
339 } 443 }
340 444
341 void PresentationFrameManager::OnPresentationSessionClosed( 445 void PresentationFrameManager::OnPresentationSessionClosed(
342 const RenderFrameHostId& render_frame_host_id, 446 const RenderFrameHostId& render_frame_host_id,
343 const std::string& presentation_id) { 447 const std::string& presentation_id) {
344 auto presentation_frame = presentation_frames_.get(render_frame_host_id); 448 auto presentation_frame = presentation_frames_.get(render_frame_host_id);
345 if (presentation_frame) 449 if (presentation_frame)
346 presentation_frame->OnPresentationSessionClosed(presentation_id); 450 presentation_frame->OnPresentationSessionClosed(presentation_id);
347 } 451 }
348 452
349 const MediaRoute::Id PresentationFrameManager::GetRouteId( 453 const MediaRoute::Id PresentationFrameManager::GetRouteId(
350 const RenderFrameHostId& render_frame_host_id, 454 const RenderFrameHostId& render_frame_host_id,
351 const std::string& presentation_id) const { 455 const std::string& presentation_id) const {
352 auto presentation_frame = presentation_frames_.get(render_frame_host_id); 456 auto presentation_frame = presentation_frames_.get(render_frame_host_id);
353 return presentation_frame ? presentation_frame->GetRouteId(presentation_id) 457 return presentation_frame ? presentation_frame->GetRouteId(presentation_id)
354 : ""; 458 : "";
355 } 459 }
356 460
357 const std::vector<MediaRoute::Id> PresentationFrameManager::GetRouteIds(
358 const RenderFrameHostId& render_frame_host_id) const {
359 auto presentation_frame = presentation_frames_.get(render_frame_host_id);
360 return presentation_frame ? presentation_frame->GetRouteIds()
361 : std::vector<MediaRoute::Id>();
362 }
363
364 bool PresentationFrameManager::SetScreenAvailabilityListener( 461 bool PresentationFrameManager::SetScreenAvailabilityListener(
365 const RenderFrameHostId& render_frame_host_id, 462 const RenderFrameHostId& render_frame_host_id,
366 content::PresentationScreenAvailabilityListener* listener) { 463 content::PresentationScreenAvailabilityListener* listener) {
367 DCHECK(listener); 464 DCHECK(listener);
368 auto presentation_frame = GetOrAddPresentationFrame(render_frame_host_id); 465 auto presentation_frame = GetOrAddPresentationFrame(render_frame_host_id);
369 return presentation_frame->SetScreenAvailabilityListener(listener); 466 return presentation_frame->SetScreenAvailabilityListener(listener);
370 } 467 }
371 468
372 bool PresentationFrameManager::RemoveScreenAvailabilityListener( 469 bool PresentationFrameManager::RemoveScreenAvailabilityListener(
373 const RenderFrameHostId& render_frame_host_id, 470 const RenderFrameHostId& render_frame_host_id,
374 content::PresentationScreenAvailabilityListener* listener) { 471 content::PresentationScreenAvailabilityListener* listener) {
375 DCHECK(listener); 472 DCHECK(listener);
376 auto presentation_frame = presentation_frames_.get(render_frame_host_id); 473 auto presentation_frame = presentation_frames_.get(render_frame_host_id);
377 return presentation_frame && 474 return presentation_frame &&
378 presentation_frame->RemoveScreenAvailabilityListener(listener); 475 presentation_frame->RemoveScreenAvailabilityListener(listener);
379 } 476 }
380 477
381 bool PresentationFrameManager::HasScreenAvailabilityListenerForTest( 478 bool PresentationFrameManager::HasScreenAvailabilityListenerForTest(
382 const RenderFrameHostId& render_frame_host_id, 479 const RenderFrameHostId& render_frame_host_id,
383 const MediaSource::Id& source_id) const { 480 const MediaSource::Id& source_id) const {
384 auto presentation_frame = presentation_frames_.get(render_frame_host_id); 481 auto presentation_frame = presentation_frames_.get(render_frame_host_id);
385 return presentation_frame && 482 return presentation_frame &&
386 presentation_frame->HasScreenAvailabilityListenerForTest(source_id); 483 presentation_frame->HasScreenAvailabilityListenerForTest(source_id);
387 } 484 }
388 485
486 void PresentationFrameManager::SendMessage(
487 const RenderFrameHostId& render_frame_host_id,
488 const content::PresentationSessionInfo& session,
489 scoped_ptr<content::PresentationSessionMessage> message,
490 const content::SendMessageCallback send_message_cb) {
491 PresentationFrame* presentation_frame =
492 presentation_frames_.get(render_frame_host_id);
493 if (!presentation_frame) {
494 DVLOG(2) << "SendMessage: PresentationFrame does not exist "
495 << "for: (" << render_frame_host_id.first << ", "
496 << render_frame_host_id.second << ")";
497 send_message_cb.Run(false);
498 return;
499 }
500
501 presentation_frame->SendMessage(session, message.Pass(), send_message_cb);
502 }
503
389 bool PresentationFrameManager::ListenForSessionStateChange( 504 bool PresentationFrameManager::ListenForSessionStateChange(
390 const RenderFrameHostId& render_frame_host_id, 505 const RenderFrameHostId& render_frame_host_id,
391 content::PresentationSessionStateListener* listener) { 506 content::PresentationSessionStateListener* listener) {
392 PresentationFrame* presentation_frame = 507 PresentationFrame* presentation_frame =
393 GetOrAddPresentationFrame(render_frame_host_id); 508 GetOrAddPresentationFrame(render_frame_host_id);
394 return presentation_frame->ListenForSessionStateChange(listener); 509 return presentation_frame->ListenForSessionStateChange(listener);
395 } 510 }
396 511
397 void PresentationFrameManager::ListenForSessionMessages( 512 void PresentationFrameManager::ListenForSessionMessages(
398 const RenderFrameHostId& render_frame_host_id, 513 const RenderFrameHostId& render_frame_host_id,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 auto presentation_frame = presentation_frames_.get(render_frame_host_id); 545 auto presentation_frame = presentation_frames_.get(render_frame_host_id);
431 if (presentation_frame) 546 if (presentation_frame)
432 presentation_frame->Reset(); 547 presentation_frame->Reset();
433 } 548 }
434 549
435 PresentationFrame* PresentationFrameManager::GetOrAddPresentationFrame( 550 PresentationFrame* PresentationFrameManager::GetOrAddPresentationFrame(
436 const RenderFrameHostId& render_frame_host_id) { 551 const RenderFrameHostId& render_frame_host_id) {
437 if (!presentation_frames_.contains(render_frame_host_id)) { 552 if (!presentation_frames_.contains(render_frame_host_id)) {
438 presentation_frames_.add( 553 presentation_frames_.add(
439 render_frame_host_id, 554 render_frame_host_id,
440 scoped_ptr<PresentationFrame>( 555 scoped_ptr<PresentationFrame>(new PresentationFrame(
441 new PresentationFrame(web_contents_, router_))); 556 web_contents_, render_frame_host_id, router_)));
442 } 557 }
443 return presentation_frames_.get(render_frame_host_id); 558 return presentation_frames_.get(render_frame_host_id);
444 } 559 }
445 560
446 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) { 561 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) {
447 router_ = router; 562 router_ = router;
448 } 563 }
449 564
450 PresentationServiceDelegateImpl* 565 PresentationServiceDelegateImpl*
451 PresentationServiceDelegateImpl::GetOrCreateForWebContents( 566 PresentationServiceDelegateImpl::GetOrCreateForWebContents(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 const MediaRoute* route, 678 const MediaRoute* route,
564 const std::string& presentation_id, 679 const std::string& presentation_id,
565 const std::string& error_text) { 680 const std::string& error_text) {
566 if (!route) { 681 if (!route) {
567 error_cb.Run(content::PresentationError( 682 error_cb.Run(content::PresentationError(
568 content::PRESENTATION_ERROR_NO_PRESENTATION_FOUND, error_text)); 683 content::PRESENTATION_ERROR_NO_PRESENTATION_FOUND, error_text));
569 } else { 684 } else {
570 DVLOG(1) << "OnJoinRouteResponse: " 685 DVLOG(1) << "OnJoinRouteResponse: "
571 << "route_id: " << route->media_route_id() 686 << "route_id: " << route->media_route_id()
572 << ", presentation URL: " << session.presentation_url 687 << ", presentation URL: " << session.presentation_url
573 << ", presentation ID: " << session.presentation_id; 688 << ", presentation ID: " << session.presentation_id
689 << ", offscreen? " << route->is_offscreen_presentation();
574 DCHECK_EQ(session.presentation_id, presentation_id); 690 DCHECK_EQ(session.presentation_id, presentation_id);
575 frame_manager_->OnPresentationSessionStarted( 691 RenderFrameHostId rfh_id(render_process_id, render_frame_id);
576 RenderFrameHostId(render_process_id, render_frame_id), false, session, 692 frame_manager_->OnPresentationSessionStarted(rfh_id, false, session,
577 route->media_route_id()); 693 *route);
578 success_cb.Run(session); 694 success_cb.Run(session);
579 } 695 }
580 } 696 }
581 697
582 void PresentationServiceDelegateImpl::OnStartSessionSucceeded( 698 void PresentationServiceDelegateImpl::OnStartSessionSucceeded(
583 int render_process_id, 699 int render_process_id,
584 int render_frame_id, 700 int render_frame_id,
585 const PresentationSessionSuccessCallback& success_cb, 701 const PresentationSessionSuccessCallback& success_cb,
586 const content::PresentationSessionInfo& new_session, 702 const content::PresentationSessionInfo& new_session,
587 const MediaRoute::Id& route_id) { 703 const MediaRoute& route) {
704 const MediaRoute::Id& route_id = route.media_route_id();
588 DVLOG(1) << "OnStartSessionSucceeded: " 705 DVLOG(1) << "OnStartSessionSucceeded: "
589 << "route_id: " << route_id 706 << "route_id: " << route_id
590 << ", presentation URL: " << new_session.presentation_url 707 << ", presentation URL: " << new_session.presentation_url
591 << ", presentation ID: " << new_session.presentation_id; 708 << ", presentation ID: " << new_session.presentation_id;
592 frame_manager_->OnPresentationSessionStarted( 709 RenderFrameHostId rfh_id(render_process_id, render_frame_id);
593 RenderFrameHostId(render_process_id, render_frame_id), false, new_session, 710 frame_manager_->OnPresentationSessionStarted(rfh_id, false, new_session,
594 route_id); 711 route);
595 success_cb.Run(new_session); 712 success_cb.Run(new_session);
596 } 713 }
597 714
598 void PresentationServiceDelegateImpl::StartSession( 715 void PresentationServiceDelegateImpl::StartSession(
599 int render_process_id, 716 int render_process_id,
600 int render_frame_id, 717 int render_frame_id,
601 const std::string& presentation_url, 718 const std::string& presentation_url,
602 const PresentationSessionSuccessCallback& success_cb, 719 const PresentationSessionSuccessCallback& success_cb,
603 const PresentationSessionErrorCallback& error_cb) { 720 const PresentationSessionErrorCallback& error_cb) {
604 if (presentation_url.empty() || !IsValidPresentationUrl(presentation_url)) { 721 if (presentation_url.empty() || !IsValidPresentationUrl(presentation_url)) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 return; 774 return;
658 } 775 }
659 router_->CloseRoute(route_id); 776 router_->CloseRoute(route_id);
660 } 777 }
661 778
662 void PresentationServiceDelegateImpl::ListenForSessionMessages( 779 void PresentationServiceDelegateImpl::ListenForSessionMessages(
663 int render_process_id, 780 int render_process_id,
664 int render_frame_id, 781 int render_frame_id,
665 const content::PresentationSessionInfo& session, 782 const content::PresentationSessionInfo& session,
666 const content::PresentationSessionMessageCallback& message_cb) { 783 const content::PresentationSessionMessageCallback& message_cb) {
667 frame_manager_->ListenForSessionMessages( 784 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
668 RenderFrameHostId(render_process_id, render_frame_id), session, 785 frame_manager_->ListenForSessionMessages(render_frame_host_id, session,
669 message_cb); 786 message_cb);
670 } 787 }
671 788
672 void PresentationServiceDelegateImpl::SendMessage( 789 void PresentationServiceDelegateImpl::SendMessage(
673 int render_process_id, 790 int render_process_id,
674 int render_frame_id, 791 int render_frame_id,
675 const content::PresentationSessionInfo& session, 792 const content::PresentationSessionInfo& session,
676 scoped_ptr<content::PresentationSessionMessage> message, 793 scoped_ptr<content::PresentationSessionMessage> message,
677 const SendMessageCallback& send_message_cb) { 794 const content::SendMessageCallback& send_message_cb) {
678 const MediaRoute::Id& route_id = frame_manager_->GetRouteId( 795 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
679 RenderFrameHostId(render_process_id, render_frame_id), 796 frame_manager_->SendMessage(render_frame_host_id, session, message.Pass(),
680 session.presentation_id); 797 send_message_cb);
681 if (route_id.empty()) {
682 DVLOG(1) << "No active route for " << session.presentation_id;
683 send_message_cb.Run(false);
684 return;
685 }
686
687 if (message->is_binary()) {
688 router_->SendRouteBinaryMessage(route_id, message->data.Pass(),
689 send_message_cb);
690 } else {
691 router_->SendRouteMessage(route_id, message->message, send_message_cb);
692 }
693 } 798 }
694 799
695 bool PresentationServiceDelegateImpl::ListenForSessionStateChange( 800 bool PresentationServiceDelegateImpl::ListenForSessionStateChange(
696 int render_process_id, 801 int render_process_id,
697 int render_frame_id, 802 int render_frame_id,
698 content::PresentationSessionStateListener* listener) { 803 content::PresentationSessionStateListener* listener) {
699 return frame_manager_->ListenForSessionStateChange( 804 return frame_manager_->ListenForSessionStateChange(
700 RenderFrameHostId(render_process_id, render_frame_id), listener); 805 RenderFrameHostId(render_process_id, render_frame_id), listener);
701 } 806 }
702 807
808 void PresentationServiceDelegateImpl::NotifyWhenReceiverSessionIsAvailable(
809 int render_process_id,
810 int render_frame_id,
811 const content::PresentationReceiverSessionAvailableCallback& callback) {
812 // We only support receiver APIs in offscreen tabs created for offscreen
813 // presentations.
814 // See ReceiverPresentationServiceDelegateImpl for details.
mark a. foltz 2015/10/12 21:56:10 We need to decide how to handle the receiver APIs
imcheng 2015/10/17 01:00:24 Ok, I think we decided on PresentationServiceDeleg
815 NOTIMPLEMENTED();
816 callback.Run(nullptr);
817 }
818
819 std::vector<content::PresentationSessionInfo>
820 PresentationServiceDelegateImpl::GetPresentationReceiverSessions(
821 int render_process_id,
822 int render_frame_id) {
823 // See comment in |NotifyWhenReceiverSessionIsAvailable()|.
824 NOTIMPLEMENTED();
825 return std::vector<content::PresentationSessionInfo>();
826 }
827
703 void PresentationServiceDelegateImpl::OnRouteResponse( 828 void PresentationServiceDelegateImpl::OnRouteResponse(
704 const MediaRoute* route, 829 const MediaRoute* route,
705 const std::string& presentation_id, 830 const std::string& presentation_id,
706 const std::string& error) { 831 const std::string& error) {
707 if (!route) 832 if (!route)
708 return; 833 return;
834
709 const MediaSource& source = route->media_source(); 835 const MediaSource& source = route->media_source();
710 DCHECK(!source.Empty()); 836 DCHECK(!source.Empty());
711 if (!default_source_.Equals(source)) 837 if (!default_source_.Equals(source))
712 return; 838 return;
839
713 RenderFrameHost* main_frame = web_contents_->GetMainFrame(); 840 RenderFrameHost* main_frame = web_contents_->GetMainFrame();
714 if (!main_frame) 841 if (!main_frame)
715 return; 842 return;
843
716 RenderFrameHostId render_frame_host_id(GetRenderFrameHostId(main_frame)); 844 RenderFrameHostId render_frame_host_id(GetRenderFrameHostId(main_frame));
717 frame_manager_->OnPresentationSessionStarted( 845 content::PresentationSessionInfo session(
718 render_frame_host_id, true, 846 PresentationUrlFromMediaSource(source), presentation_id);
719 content::PresentationSessionInfo(PresentationUrlFromMediaSource(source), 847
720 presentation_id), 848 frame_manager_->OnPresentationSessionStarted(render_frame_host_id, true,
721 route->media_route_id()); 849 session, *route);
722 } 850 }
723 851
724 void PresentationServiceDelegateImpl::AddDefaultMediaSourceObserver( 852 void PresentationServiceDelegateImpl::AddDefaultMediaSourceObserver(
725 DefaultMediaSourceObserver* observer) { 853 DefaultMediaSourceObserver* observer) {
726 default_media_source_observers_.AddObserver(observer); 854 default_media_source_observers_.AddObserver(observer);
727 } 855 }
728 856
729 void PresentationServiceDelegateImpl::RemoveDefaultMediaSourceObserver( 857 void PresentationServiceDelegateImpl::RemoveDefaultMediaSourceObserver(
730 DefaultMediaSourceObserver* observer) { 858 DefaultMediaSourceObserver* observer) {
731 default_media_source_observers_.RemoveObserver(observer); 859 default_media_source_observers_.RemoveObserver(observer);
(...skipping 13 matching lines...) Expand all
745 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( 873 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest(
746 int render_process_id, 874 int render_process_id,
747 int render_frame_id, 875 int render_frame_id,
748 const MediaSource::Id& source_id) const { 876 const MediaSource::Id& source_id) const {
749 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 877 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
750 return frame_manager_->HasScreenAvailabilityListenerForTest( 878 return frame_manager_->HasScreenAvailabilityListenerForTest(
751 render_frame_host_id, source_id); 879 render_frame_host_id, source_id);
752 } 880 }
753 881
754 } // namespace media_router 882 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698