| 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 if (!session_info.is_null()) { | 175 DCHECK(!session_info.is_null()); |
| 176 controller_->didStartDefaultSession( | 176 controller_->didStartDefaultSession( |
| 177 new PresentationSessionClient(session_info.Pass())); | 177 new PresentationSessionClient(session_info.Pass())); |
| 178 } | |
| 179 } | 178 } |
| 180 | 179 |
| 181 void PresentationDispatcher::OnSessionCreated( | 180 void PresentationDispatcher::OnSessionCreated( |
| 182 blink::WebPresentationSessionClientCallbacks* callback, | 181 blink::WebPresentationSessionClientCallbacks* callback, |
| 183 presentation::PresentationSessionInfoPtr session_info, | 182 presentation::PresentationSessionInfoPtr session_info, |
| 184 presentation::PresentationErrorPtr error) { | 183 presentation::PresentationErrorPtr error) { |
| 185 DCHECK(callback); | 184 DCHECK(callback); |
| 186 if (!error.is_null()) { | 185 if (!error.is_null()) { |
| 187 DCHECK(session_info.is_null()); | 186 DCHECK(session_info.is_null()); |
| 188 callback->onError(new blink::WebPresentationError( | 187 callback->onError(new blink::WebPresentationError( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 presentation_service_->ListenForDefaultSessionStart(base::Bind( | 222 presentation_service_->ListenForDefaultSessionStart(base::Bind( |
| 224 &PresentationDispatcher::OnDefaultSessionStarted, | 223 &PresentationDispatcher::OnDefaultSessionStarted, |
| 225 base::Unretained(this))); | 224 base::Unretained(this))); |
| 226 presentation_service_->ListenForSessionStateChange(base::Bind( | 225 presentation_service_->ListenForSessionStateChange(base::Bind( |
| 227 &PresentationDispatcher::OnSessionStateChange, | 226 &PresentationDispatcher::OnSessionStateChange, |
| 228 base::Unretained(this))); | 227 base::Unretained(this))); |
| 229 */ | 228 */ |
| 230 } | 229 } |
| 231 | 230 |
| 232 } // namespace content | 231 } // namespace content |
| OLD | NEW |