| 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/service_registry.h" | 9 #include "content/public/common/service_registry.h" |
| 10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 void PresentationDispatcher::updateAvailableChangeWatched(bool watched) { | 81 void PresentationDispatcher::updateAvailableChangeWatched(bool watched) { |
| 82 GURL presentation_url(GetPresentationURLFromFrame(render_frame())); | 82 GURL presentation_url(GetPresentationURLFromFrame(render_frame())); |
| 83 DoUpdateAvailableChangeWatched(presentation_url.spec(), watched); | 83 DoUpdateAvailableChangeWatched(presentation_url.spec(), watched); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void PresentationDispatcher::DoUpdateAvailableChangeWatched( | 86 void PresentationDispatcher::DoUpdateAvailableChangeWatched( |
| 87 const std::string& presentation_url, bool watched) { | 87 const std::string& presentation_url, bool watched) { |
| 88 ConnectToPresentationServiceIfNeeded(); | 88 ConnectToPresentationServiceIfNeeded(); |
| 89 if (watched) { | 89 if (watched) { |
| 90 presentation_service_->GetScreenAvailability( | 90 presentation_service_->ListenForScreenAvailability( |
| 91 presentation_url, | 91 presentation_url, |
| 92 base::Bind(&PresentationDispatcher::OnScreenAvailabilityChanged, | 92 base::Bind(&PresentationDispatcher::OnScreenAvailabilityChanged, |
| 93 base::Unretained(this))); | 93 base::Unretained(this))); |
| 94 } else { | 94 } else { |
| 95 presentation_service_->OnScreenAvailabilityListenerRemoved( | 95 presentation_service_->RemoveScreenAvailabilityListener(presentation_url); |
| 96 presentation_url); | |
| 97 } | 96 } |
| 98 } | 97 } |
| 99 | 98 |
| 100 void PresentationDispatcher::startSession( | 99 void PresentationDispatcher::startSession( |
| 101 const blink::WebString& presentationUrl, | 100 const blink::WebString& presentationUrl, |
| 102 const blink::WebString& presentationId, | 101 const blink::WebString& presentationId, |
| 103 blink::WebPresentationSessionClientCallbacks* callback) { | 102 blink::WebPresentationSessionClientCallbacks* callback) { |
| 104 DCHECK(callback); | 103 DCHECK(callback); |
| 105 ConnectToPresentationServiceIfNeeded(); | 104 ConnectToPresentationServiceIfNeeded(); |
| 106 | 105 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 &presentation_service_); | 218 &presentation_service_); |
| 220 presentation_service_->ListenForDefaultSessionStart(base::Bind( | 219 presentation_service_->ListenForDefaultSessionStart(base::Bind( |
| 221 &PresentationDispatcher::OnDefaultSessionStarted, | 220 &PresentationDispatcher::OnDefaultSessionStarted, |
| 222 base::Unretained(this))); | 221 base::Unretained(this))); |
| 223 presentation_service_->ListenForSessionStateChange(base::Bind( | 222 presentation_service_->ListenForSessionStateChange(base::Bind( |
| 224 &PresentationDispatcher::OnSessionStateChange, | 223 &PresentationDispatcher::OnSessionStateChange, |
| 225 base::Unretained(this))); | 224 base::Unretained(this))); |
| 226 } | 225 } |
| 227 | 226 |
| 228 } // namespace content | 227 } // namespace content |
| OLD | NEW |