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 "content/renderer/presentation/presentation_dispatcher.h" | 5 #include "content/renderer/presentation/presentation_dispatcher.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/presentation/presentation_service.mojom.h" | 8 #include "content/common/presentation/presentation_service.mojom.h" |
9 #include "content/public/common/service_registry.h" | 9 #include "content/public/common/service_registry.h" |
10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 void PresentationDispatcher::OnDefaultSessionStarted( | 165 void PresentationDispatcher::OnDefaultSessionStarted( |
166 presentation::PresentationSessionInfoPtr session_info) { | 166 presentation::PresentationSessionInfoPtr session_info) { |
167 if (!controller_) | 167 if (!controller_) |
168 return; | 168 return; |
169 | 169 |
170 // Reset the callback to get the next event. | 170 // Reset the callback to get the next event. |
171 presentation_service_->ListenForDefaultSessionStart(base::Bind( | 171 presentation_service_->ListenForDefaultSessionStart(base::Bind( |
172 &PresentationDispatcher::OnDefaultSessionStarted, | 172 &PresentationDispatcher::OnDefaultSessionStarted, |
173 base::Unretained(this))); | 173 base::Unretained(this))); |
174 | 174 |
175 DCHECK(!session_info.is_null()); | 175 if (!session_info.is_null()) { |
176 controller_->didStartDefaultSession( | 176 controller_->didStartDefaultSession( |
177 new PresentationSessionClient(session_info.Pass())); | 177 new PresentationSessionClient(session_info.Pass())); |
| 178 } |
178 } | 179 } |
179 | 180 |
180 void PresentationDispatcher::OnSessionCreated( | 181 void PresentationDispatcher::OnSessionCreated( |
181 blink::WebPresentationSessionClientCallbacks* callback, | 182 blink::WebPresentationSessionClientCallbacks* callback, |
182 presentation::PresentationSessionInfoPtr session_info, | 183 presentation::PresentationSessionInfoPtr session_info, |
183 presentation::PresentationErrorPtr error) { | 184 presentation::PresentationErrorPtr error) { |
184 DCHECK(callback); | 185 DCHECK(callback); |
185 if (!error.is_null()) { | 186 if (!error.is_null()) { |
186 DCHECK(session_info.is_null()); | 187 DCHECK(session_info.is_null()); |
187 callback->onError(new blink::WebPresentationError( | 188 callback->onError(new blink::WebPresentationError( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 presentation_service_->ListenForDefaultSessionStart(base::Bind( | 223 presentation_service_->ListenForDefaultSessionStart(base::Bind( |
223 &PresentationDispatcher::OnDefaultSessionStarted, | 224 &PresentationDispatcher::OnDefaultSessionStarted, |
224 base::Unretained(this))); | 225 base::Unretained(this))); |
225 presentation_service_->ListenForSessionStateChange(base::Bind( | 226 presentation_service_->ListenForSessionStateChange(base::Bind( |
226 &PresentationDispatcher::OnSessionStateChange, | 227 &PresentationDispatcher::OnSessionStateChange, |
227 base::Unretained(this))); | 228 base::Unretained(this))); |
228 */ | 229 */ |
229 } | 230 } |
230 | 231 |
231 } // namespace content | 232 } // namespace content |
OLD | NEW |