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

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 windows compile error 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 std::vector<GURL> urls; 378 std::vector<GURL> urls;
379 for (const auto& url : presentationUrls) 379 for (const auto& url : presentationUrls)
380 urls.push_back(url); 380 urls.push_back(url);
381 381
382 presentation_service_->SetDefaultPresentationUrls(urls); 382 presentation_service_->SetDefaultPresentationUrls(urls);
383 } 383 }
384 384
385 void PresentationDispatcher::SetReceiver( 385 void PresentationDispatcher::SetReceiver(
386 blink::WebPresentationReceiver* receiver) { 386 blink::WebPresentationReceiver* receiver) {
387 ConnectToPresentationServiceIfNeeded();
388 receiver_ = receiver; 387 receiver_ = receiver;
388
389 // Create receiver PSImpl after loading document.
390 if (render_frame() && render_frame()->GetWebFrame() &&
391 !render_frame()->GetWebFrame()->IsLoading()) {
392 ConnectToPresentationServiceIfNeeded();
393 }
389 } 394 }
390 395
391 void PresentationDispatcher::DidCommitProvisionalLoad( 396 void PresentationDispatcher::DidCommitProvisionalLoad(
392 bool is_new_navigation, 397 bool is_new_navigation,
393 bool is_same_document_navigation) { 398 bool is_same_document_navigation) {
394 blink::WebFrame* frame = render_frame()->GetWebFrame(); 399 blink::WebFrame* frame = render_frame()->GetWebFrame();
395 // If not top-level navigation. 400 // If not top-level navigation.
396 if (frame->Parent() || is_same_document_navigation) 401 if (frame->Parent() || is_same_document_navigation)
397 return; 402 return;
398 403
399 // Remove all pending send message requests. 404 // Remove all pending send message requests.
400 MessageRequestQueue empty; 405 MessageRequestQueue empty;
401 std::swap(message_request_queue_, empty); 406 std::swap(message_request_queue_, empty);
402 } 407 }
403 408
409 void PresentationDispatcher::DidFinishDocumentLoad() {
410 if (receiver_)
411 ConnectToPresentationServiceIfNeeded();
412 }
413
404 void PresentationDispatcher::OnDestruct() { 414 void PresentationDispatcher::OnDestruct() {
405 delete this; 415 delete this;
406 } 416 }
407 417
408 void PresentationDispatcher::WidgetWillClose() { 418 void PresentationDispatcher::WidgetWillClose() {
409 if (!receiver_) 419 if (!receiver_)
410 return; 420 return;
411 421
412 receiver_->DidChangeConnectionState( 422 receiver_->DidChangeConnectionState(
413 blink::WebPresentationConnectionState::kTerminated); 423 blink::WebPresentationConnectionState::kTerminated);
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 795
786 PresentationDispatcher::ListeningStatus::ListeningStatus( 796 PresentationDispatcher::ListeningStatus::ListeningStatus(
787 const GURL& availability_url) 797 const GURL& availability_url)
788 : url(availability_url), 798 : url(availability_url),
789 last_known_availability(ScreenAvailability::UNKNOWN), 799 last_known_availability(ScreenAvailability::UNKNOWN),
790 listening_state(ListeningState::INACTIVE) {} 800 listening_state(ListeningState::INACTIVE) {}
791 801
792 PresentationDispatcher::ListeningStatus::~ListeningStatus() {} 802 PresentationDispatcher::ListeningStatus::~ListeningStatus() {}
793 803
794 } // namespace content 804 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698