Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 2801823003: [Presentation API] Change connection to 'connected' if start a presentation with "https://www.googl… (Closed)
Patch Set: fix content_unittest and layout test failures Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 if (!render_frame() || !render_frame()->GetWebFrame())
imcheng 2017/04/08 00:05:59 This seems a bit easier to understand if you flipp
zhaobin 2017/04/08 01:36:01 Done.
389 return;
390
391 // Create receiver PSImpl after loading document.
392 if (!render_frame()->GetWebFrame()->isLoading())
393 ConnectToPresentationServiceIfNeeded();
388 } 394 }
389 395
390 void PresentationDispatcher::DidCommitProvisionalLoad( 396 void PresentationDispatcher::DidCommitProvisionalLoad(
391 bool is_new_navigation, 397 bool is_new_navigation,
392 bool is_same_document_navigation) { 398 bool is_same_document_navigation) {
393 blink::WebFrame* frame = render_frame()->GetWebFrame(); 399 blink::WebFrame* frame = render_frame()->GetWebFrame();
394 // If not top-level navigation. 400 // If not top-level navigation.
395 if (frame->parent() || is_same_document_navigation) 401 if (frame->parent() || is_same_document_navigation)
396 return; 402 return;
397 403
398 // Remove all pending send message requests. 404 // Remove all pending send message requests.
399 MessageRequestQueue empty; 405 MessageRequestQueue empty;
400 std::swap(message_request_queue_, empty); 406 std::swap(message_request_queue_, empty);
401 } 407 }
402 408
409 void PresentationDispatcher::DidFinishDocumentLoad() {
410 if (receiver_)
411 ConnectToPresentationServiceIfNeeded();
412 }
413
403 void PresentationDispatcher::OnDestruct() { 414 void PresentationDispatcher::OnDestruct() {
404 delete this; 415 delete this;
405 } 416 }
406 417
407 void PresentationDispatcher::WidgetWillClose() { 418 void PresentationDispatcher::WidgetWillClose() {
408 if (!receiver_) 419 if (!receiver_)
409 return; 420 return;
410 421
411 receiver_->didChangeConnectionState( 422 receiver_->didChangeConnectionState(
412 blink::WebPresentationConnectionState::Terminated); 423 blink::WebPresentationConnectionState::Terminated);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 795
785 PresentationDispatcher::ListeningStatus::ListeningStatus( 796 PresentationDispatcher::ListeningStatus::ListeningStatus(
786 const GURL& availability_url) 797 const GURL& availability_url)
787 : url(availability_url), 798 : url(availability_url),
788 last_known_availability(ScreenAvailability::UNKNOWN), 799 last_known_availability(ScreenAvailability::UNKNOWN),
789 listening_state(ListeningState::INACTIVE) {} 800 listening_state(ListeningState::INACTIVE) {}
790 801
791 PresentationDispatcher::ListeningStatus::~ListeningStatus() {} 802 PresentationDispatcher::ListeningStatus::~ListeningStatus() {}
792 803
793 } // namespace content 804 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698