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

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

Issue 2737413003: [Presentation API] Remove references to presentation sessions. (Closed)
Patch Set: Update presentation service mock. Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/offscreen_presentation_manager.h" 5 #include "chrome/browser/media/router/offscreen_presentation_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 : presentation_id_(presentation_id), presentation_url_(presentation_url) {} 97 : presentation_id_(presentation_id), presentation_url_(presentation_url) {}
98 98
99 OffscreenPresentationManager::OffscreenPresentation::~OffscreenPresentation() {} 99 OffscreenPresentationManager::OffscreenPresentation::~OffscreenPresentation() {}
100 100
101 void OffscreenPresentationManager::OffscreenPresentation::RegisterController( 101 void OffscreenPresentationManager::OffscreenPresentation::RegisterController(
102 const RenderFrameHostId& render_frame_host_id, 102 const RenderFrameHostId& render_frame_host_id,
103 content::PresentationConnectionPtr controller_connection_ptr, 103 content::PresentationConnectionPtr controller_connection_ptr,
104 content::PresentationConnectionRequest receiver_connection_request) { 104 content::PresentationConnectionRequest receiver_connection_request) {
105 if (!receiver_callback_.is_null()) { 105 if (!receiver_callback_.is_null()) {
106 receiver_callback_.Run( 106 receiver_callback_.Run(
107 content::PresentationSessionInfo(presentation_url_, presentation_id_), 107 content::PresentationInfo(presentation_url_, presentation_id_),
108 std::move(controller_connection_ptr), 108 std::move(controller_connection_ptr),
109 std::move(receiver_connection_request)); 109 std::move(receiver_connection_request));
110 } else { 110 } else {
111 pending_controllers_.insert(std::make_pair( 111 pending_controllers_.insert(std::make_pair(
112 render_frame_host_id, base::MakeUnique<ControllerConnection>( 112 render_frame_host_id, base::MakeUnique<ControllerConnection>(
113 std::move(controller_connection_ptr), 113 std::move(controller_connection_ptr),
114 std::move(receiver_connection_request)))); 114 std::move(receiver_connection_request))));
115 } 115 }
116 } 116 }
117 117
118 void OffscreenPresentationManager::OffscreenPresentation::UnregisterController( 118 void OffscreenPresentationManager::OffscreenPresentation::UnregisterController(
119 const RenderFrameHostId& render_frame_host_id) { 119 const RenderFrameHostId& render_frame_host_id) {
120 pending_controllers_.erase(render_frame_host_id); 120 pending_controllers_.erase(render_frame_host_id);
121 } 121 }
122 122
123 void OffscreenPresentationManager::OffscreenPresentation::RegisterReceiver( 123 void OffscreenPresentationManager::OffscreenPresentation::RegisterReceiver(
124 const content::ReceiverConnectionAvailableCallback& receiver_callback) { 124 const content::ReceiverConnectionAvailableCallback& receiver_callback) {
125 DCHECK(receiver_callback_.is_null()); 125 DCHECK(receiver_callback_.is_null());
126 126
127 for (auto& controller : pending_controllers_) { 127 for (auto& controller : pending_controllers_) {
128 receiver_callback.Run( 128 receiver_callback.Run(
129 content::PresentationSessionInfo(presentation_url_, presentation_id_), 129 content::PresentationInfo(presentation_url_, presentation_id_),
130 std::move(controller.second->controller_connection_ptr), 130 std::move(controller.second->controller_connection_ptr),
131 std::move(controller.second->receiver_connection_request)); 131 std::move(controller.second->receiver_connection_request));
132 } 132 }
133 receiver_callback_ = receiver_callback; 133 receiver_callback_ = receiver_callback;
134 pending_controllers_.clear(); 134 pending_controllers_.clear();
135 } 135 }
136 136
137 bool OffscreenPresentationManager::OffscreenPresentation::IsValid() const { 137 bool OffscreenPresentationManager::OffscreenPresentation::IsValid() const {
138 return !(pending_controllers_.empty() && receiver_callback_.is_null()); 138 return !(pending_controllers_.empty() && receiver_callback_.is_null());
139 } 139 }
140 140
141 OffscreenPresentationManager::OffscreenPresentation::ControllerConnection:: 141 OffscreenPresentationManager::OffscreenPresentation::ControllerConnection::
142 ControllerConnection( 142 ControllerConnection(
143 content::PresentationConnectionPtr controller_connection_ptr, 143 content::PresentationConnectionPtr controller_connection_ptr,
144 content::PresentationConnectionRequest receiver_connection_request) 144 content::PresentationConnectionRequest receiver_connection_request)
145 : controller_connection_ptr(std::move(controller_connection_ptr)), 145 : controller_connection_ptr(std::move(controller_connection_ptr)),
146 receiver_connection_request(std::move(receiver_connection_request)) {} 146 receiver_connection_request(std::move(receiver_connection_request)) {}
147 147
148 OffscreenPresentationManager::OffscreenPresentation::ControllerConnection:: 148 OffscreenPresentationManager::OffscreenPresentation::ControllerConnection::
149 ~ControllerConnection() {} 149 ~ControllerConnection() {}
150 150
151 } // namespace media_router 151 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698