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 <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" |
12 #include "content/common/presentation/presentation_service.mojom.h" | 13 #include "content/common/presentation/presentation_service.mojom.h" |
13 #include "content/public/common/presentation_constants.h" | 14 #include "content/public/common/presentation_constants.h" |
14 #include "content/public/common/service_registry.h" | 15 #include "content/public/common/service_registry.h" |
15 #include "content/public/renderer/render_frame.h" | 16 #include "content/public/renderer/render_frame.h" |
16 #include "content/renderer/presentation/presentation_connection_client.h" | 17 #include "content/renderer/presentation/presentation_connection_client.h" |
17 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
18 #include "third_party/WebKit/public/platform/WebURL.h" | 19 #include "third_party/WebKit/public/platform/WebURL.h" |
19 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" | 20 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" |
20 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" | 21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nController.h" |
21 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" | 22 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 if (!error.is_null()) { | 377 if (!error.is_null()) { |
377 DCHECK(session_info.is_null()); | 378 DCHECK(session_info.is_null()); |
378 callback->onError(blink::WebPresentationError( | 379 callback->onError(blink::WebPresentationError( |
379 GetWebPresentationErrorTypeFromMojo(error->error_type), | 380 GetWebPresentationErrorTypeFromMojo(error->error_type), |
380 blink::WebString::fromUTF8(error->message))); | 381 blink::WebString::fromUTF8(error->message))); |
381 return; | 382 return; |
382 } | 383 } |
383 | 384 |
384 DCHECK(!session_info.is_null()); | 385 DCHECK(!session_info.is_null()); |
385 presentation_service_->ListenForSessionMessages(session_info.Clone()); | 386 presentation_service_->ListenForSessionMessages(session_info.Clone()); |
386 callback->onSuccess(blink::adoptWebPtr( | 387 callback->onSuccess(base::WrapUnique( |
387 new PresentationConnectionClient(std::move(session_info)))); | 388 new PresentationConnectionClient(std::move(session_info)))); |
388 } | 389 } |
389 | 390 |
390 void PresentationDispatcher::OnConnectionStateChanged( | 391 void PresentationDispatcher::OnConnectionStateChanged( |
391 mojom::PresentationSessionInfoPtr connection, | 392 mojom::PresentationSessionInfoPtr connection, |
392 mojom::PresentationConnectionState state) { | 393 mojom::PresentationConnectionState state) { |
393 if (!controller_) | 394 if (!controller_) |
394 return; | 395 return; |
395 | 396 |
396 DCHECK(!connection.is_null()); | 397 DCHECK(!connection.is_null()); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( | 523 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( |
523 const std::string& availability_url) | 524 const std::string& availability_url) |
524 : url(availability_url), | 525 : url(availability_url), |
525 last_known_availability(false), | 526 last_known_availability(false), |
526 listening_state(ListeningState::INACTIVE) {} | 527 listening_state(ListeningState::INACTIVE) {} |
527 | 528 |
528 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { | 529 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { |
529 } | 530 } |
530 | 531 |
531 } // namespace content | 532 } // namespace content |
OLD | NEW |