| 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/presentation_constants.h" | 9 #include "content/public/common/presentation_constants.h" |
| 10 #include "content/public/common/service_registry.h" | 10 #include "content/public/common/service_registry.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 if (!error.is_null()) { | 337 if (!error.is_null()) { |
| 338 DCHECK(session_info.is_null()); | 338 DCHECK(session_info.is_null()); |
| 339 callback->onError(new blink::WebPresentationError( | 339 callback->onError(new blink::WebPresentationError( |
| 340 GetWebPresentationErrorTypeFromMojo(error->error_type), | 340 GetWebPresentationErrorTypeFromMojo(error->error_type), |
| 341 blink::WebString::fromUTF8(error->message))); | 341 blink::WebString::fromUTF8(error->message))); |
| 342 return; | 342 return; |
| 343 } | 343 } |
| 344 | 344 |
| 345 DCHECK(!session_info.is_null()); | 345 DCHECK(!session_info.is_null()); |
| 346 callback->onSuccess(new PresentationSessionClient(session_info.Pass())); | 346 callback->onSuccess(new PresentationSessionClient(session_info.Pass())); |
| 347 presentation_service_->ListenForSessionMessages( |
| 348 base::Bind(&PresentationDispatcher::OnSessionMessagesReceived, |
| 349 base::Unretained(this))); |
| 347 } | 350 } |
| 348 | 351 |
| 349 void PresentationDispatcher::OnSessionStateChange( | 352 void PresentationDispatcher::OnSessionStateChange( |
| 350 presentation::PresentationSessionInfoPtr session_info, | 353 presentation::PresentationSessionInfoPtr session_info, |
| 351 presentation::PresentationSessionState session_state) { | 354 presentation::PresentationSessionState session_state) { |
| 352 if (!controller_) | 355 if (!controller_) |
| 353 return; | 356 return; |
| 354 | 357 |
| 355 presentation_service_->ListenForSessionStateChange(base::Bind( | 358 presentation_service_->ListenForSessionStateChange(base::Bind( |
| 356 &PresentationDispatcher::OnSessionStateChange, | 359 &PresentationDispatcher::OnSessionStateChange, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 400 |
| 398 // TODO(imcheng): Uncomment these once they are implemented on the browser | 401 // TODO(imcheng): Uncomment these once they are implemented on the browser |
| 399 // side. (crbug.com/459006) | 402 // side. (crbug.com/459006) |
| 400 /* | 403 /* |
| 401 presentation_service_->ListenForDefaultSessionStart(base::Bind( | 404 presentation_service_->ListenForDefaultSessionStart(base::Bind( |
| 402 &PresentationDispatcher::OnDefaultSessionStarted, | 405 &PresentationDispatcher::OnDefaultSessionStarted, |
| 403 base::Unretained(this))); | 406 base::Unretained(this))); |
| 404 presentation_service_->ListenForSessionStateChange(base::Bind( | 407 presentation_service_->ListenForSessionStateChange(base::Bind( |
| 405 &PresentationDispatcher::OnSessionStateChange, | 408 &PresentationDispatcher::OnSessionStateChange, |
| 406 base::Unretained(this))); | 409 base::Unretained(this))); |
| 407 presentation_service_->ListenForSessionMessages( | |
| 408 base::Bind(&PresentationDispatcher::OnSessionMessagesReceived, | |
| 409 base::Unretained(this))); | |
| 410 */ | 410 */ |
| 411 } | 411 } |
| 412 | 412 |
| 413 } // namespace content | 413 } // namespace content |
| OLD | NEW |