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

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

Issue 2471573005: [Presentation API] (5th) (1-UA) integrate controller and receiver side for 1-UA messaging (Closed)
Patch Set: rebase Created 4 years, 1 month 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 #include <unordered_map> 8 #include <unordered_map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 std::unique_ptr<PresentationConnectionStateSubscription>> 162 std::unique_ptr<PresentationConnectionStateSubscription>>
163 connection_state_subscriptions_; 163 connection_state_subscriptions_;
164 std::unordered_map< 164 std::unordered_map<
165 MediaRoute::Id, 165 MediaRoute::Id,
166 std::unique_ptr<PresentationSessionMessagesObserver>> 166 std::unique_ptr<PresentationSessionMessagesObserver>>
167 session_messages_observers_; 167 session_messages_observers_;
168 168
169 RenderFrameHostId render_frame_host_id_; 169 RenderFrameHostId render_frame_host_id_;
170 170
171 // References to the owning WebContents, and the corresponding MediaRouter. 171 // References to the owning WebContents, and the corresponding MediaRouter.
172 const content::WebContents* web_contents_; 172 content::WebContents* web_contents_;
173 MediaRouter* router_; 173 MediaRouter* router_;
174 }; 174 };
175 175
176 PresentationFrame::PresentationFrame( 176 PresentationFrame::PresentationFrame(
177 const RenderFrameHostId& render_frame_host_id, 177 const RenderFrameHostId& render_frame_host_id,
178 content::WebContents* web_contents, 178 content::WebContents* web_contents,
179 MediaRouter* router) 179 MediaRouter* router)
180 : render_frame_host_id_(render_frame_host_id), 180 : render_frame_host_id_(render_frame_host_id),
181 web_contents_(web_contents), 181 web_contents_(web_contents),
182 router_(router) { 182 router_(router) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 return false; 238 return false;
239 } 239 }
240 240
241 bool PresentationFrame::HasScreenAvailabilityListenerForTest( 241 bool PresentationFrame::HasScreenAvailabilityListenerForTest(
242 const MediaSource::Id& source_id) const { 242 const MediaSource::Id& source_id) const {
243 return url_to_sinks_observer_.find(source_id) != url_to_sinks_observer_.end(); 243 return url_to_sinks_observer_.find(source_id) != url_to_sinks_observer_.end();
244 } 244 }
245 245
246 void PresentationFrame::Reset() { 246 void PresentationFrame::Reset() {
247 for (const auto& pid_route_id : presentation_id_to_route_id_) 247 auto offscreen_presentation_manager = OffscreenPresentationManagerFactory::
248 GetOrCreateForControllerBrowserContext(web_contents_);
249
250 for (const auto& pid_route_id : presentation_id_to_route_id_) {
251 offscreen_presentation_manager->UnregisterOffscreenPresentationController(
252 pid_route_id.first, render_frame_host_id_);
mark a. foltz 2016/11/16 01:25:37 Side comment: If we could ensure 1 route == 1 pres
248 router_->DetachRoute(pid_route_id.second); 253 router_->DetachRoute(pid_route_id.second);
254 }
249 255
250 presentation_id_to_route_id_.clear(); 256 presentation_id_to_route_id_.clear();
251 url_to_sinks_observer_.clear(); 257 url_to_sinks_observer_.clear();
252 connection_state_subscriptions_.clear(); 258 connection_state_subscriptions_.clear();
253 session_messages_observers_.clear(); 259 session_messages_observers_.clear();
254 } 260 }
255 261
256 void PresentationFrame::RemoveConnection(const std::string& presentation_id, 262 void PresentationFrame::RemoveConnection(const std::string& presentation_id,
257 const MediaRoute::Id& route_id) { 263 const MediaRoute::Id& route_id) {
258 // Remove the presentation id mapping so a later call to Reset is a no-op. 264 // Remove the presentation id mapping so a later call to Reset is a no-op.
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( 957 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest(
952 int render_process_id, 958 int render_process_id,
953 int render_frame_id, 959 int render_frame_id,
954 const MediaSource::Id& source_id) const { 960 const MediaSource::Id& source_id) const {
955 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 961 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
956 return frame_manager_->HasScreenAvailabilityListenerForTest( 962 return frame_manager_->HasScreenAvailabilityListenerForTest(
957 render_frame_host_id, source_id); 963 render_frame_host_id, source_id);
958 } 964 }
959 965
960 } // namespace media_router 966 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698