Chromium Code Reviews| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 | 376 |
| 377 std::vector<GURL> urls; | 377 std::vector<GURL> urls; |
| 378 for (const auto& url : presentationUrls) | 378 for (const auto& url : presentationUrls) |
| 379 urls.push_back(url); | 379 urls.push_back(url); |
| 380 | 380 |
| 381 presentation_service_->SetDefaultPresentationUrls(urls); | 381 presentation_service_->SetDefaultPresentationUrls(urls); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void PresentationDispatcher::setReceiver( | 384 void PresentationDispatcher::setReceiver( |
| 385 blink::WebPresentationReceiver* receiver) { | 385 blink::WebPresentationReceiver* receiver) { |
| 386 ConnectToPresentationServiceIfNeeded(); | |
| 387 receiver_ = receiver; | 386 receiver_ = receiver; |
| 387 | |
| 388 // Create receiver PSImpl after loading document. | |
| 389 if (render_frame() && render_frame()->GetWebFrame() && | |
| 390 !render_frame()->GetWebFrame()->isLoading()) { | |
| 391 ConnectToPresentationServiceIfNeeded(); | |
| 392 } | |
| 388 } | 393 } |
| 389 | 394 |
| 390 void PresentationDispatcher::DidCommitProvisionalLoad( | 395 void PresentationDispatcher::DidCommitProvisionalLoad( |
| 391 bool is_new_navigation, | 396 bool is_new_navigation, |
| 392 bool is_same_document_navigation) { | 397 bool is_same_document_navigation) { |
| 393 blink::WebFrame* frame = render_frame()->GetWebFrame(); | 398 blink::WebFrame* frame = render_frame()->GetWebFrame(); |
| 394 // If not top-level navigation. | 399 // If not top-level navigation. |
| 395 if (frame->parent() || is_same_document_navigation) | 400 if (frame->parent() || is_same_document_navigation) |
| 396 return; | 401 return; |
| 397 | 402 |
| 398 // Remove all pending send message requests. | 403 // Remove all pending send message requests. |
| 399 MessageRequestQueue empty; | 404 MessageRequestQueue empty; |
| 400 std::swap(message_request_queue_, empty); | 405 std::swap(message_request_queue_, empty); |
| 401 } | 406 } |
| 402 | 407 |
| 408 void PresentationDispatcher::DidFinishDocumentLoad() { | |
|
mark a. foltz
2017/04/10 21:59:57
I'm assuming that receiver_ is set only for presen
zhaobin
2017/04/11 00:03:08
Yes. receiver_ is only set for receiver documents.
| |
| 409 if (receiver_) | |
| 410 ConnectToPresentationServiceIfNeeded(); | |
| 411 } | |
| 412 | |
| 403 void PresentationDispatcher::OnDestruct() { | 413 void PresentationDispatcher::OnDestruct() { |
| 404 delete this; | 414 delete this; |
| 405 } | 415 } |
| 406 | 416 |
| 407 void PresentationDispatcher::WidgetWillClose() { | 417 void PresentationDispatcher::WidgetWillClose() { |
| 408 if (!receiver_) | 418 if (!receiver_) |
| 409 return; | 419 return; |
| 410 | 420 |
| 411 receiver_->didChangeConnectionState( | 421 receiver_->didChangeConnectionState( |
| 412 blink::WebPresentationConnectionState::Terminated); | 422 blink::WebPresentationConnectionState::Terminated); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 784 | 794 |
| 785 PresentationDispatcher::ListeningStatus::ListeningStatus( | 795 PresentationDispatcher::ListeningStatus::ListeningStatus( |
| 786 const GURL& availability_url) | 796 const GURL& availability_url) |
| 787 : url(availability_url), | 797 : url(availability_url), |
| 788 last_known_availability(ScreenAvailability::UNKNOWN), | 798 last_known_availability(ScreenAvailability::UNKNOWN), |
| 789 listening_state(ListeningState::INACTIVE) {} | 799 listening_state(ListeningState::INACTIVE) {} |
| 790 | 800 |
| 791 PresentationDispatcher::ListeningStatus::~ListeningStatus() {} | 801 PresentationDispatcher::ListeningStatus::~ListeningStatus() {} |
| 792 | 802 |
| 793 } // namespace content | 803 } // namespace content |
| OLD | NEW |