| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (watched) | 104 if (watched) |
| 105 presentation_service_->ListenForScreenAvailability(); | 105 presentation_service_->ListenForScreenAvailability(); |
| 106 else | 106 else |
| 107 presentation_service_->StopListeningForScreenAvailability(); | 107 presentation_service_->StopListeningForScreenAvailability(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void PresentationDispatcher::startSession( | 110 void PresentationDispatcher::startSession( |
| 111 const blink::WebString& presentationUrl, | 111 const blink::WebString& presentationUrl, |
| 112 const blink::WebString& presentationId, | 112 const blink::WebString& presentationId, |
| 113 blink::WebPresentationSessionClientCallbacks* callback) { | 113 blink::WebPresentationSessionClientCallbacks* callback) { |
| 114 startSession(presentationUrl, callback); |
| 115 } |
| 116 |
| 117 void PresentationDispatcher::startSession( |
| 118 const blink::WebString& presentationUrl, |
| 119 blink::WebPresentationSessionClientCallbacks* callback) { |
| 114 DCHECK(callback); | 120 DCHECK(callback); |
| 115 ConnectToPresentationServiceIfNeeded(); | 121 ConnectToPresentationServiceIfNeeded(); |
| 116 | 122 |
| 117 // The dispatcher owns the service so |this| will be valid when | 123 // The dispatcher owns the service so |this| will be valid when |
| 118 // OnSessionCreated() is called. |callback| needs to be alive and also needs | 124 // OnSessionCreated() is called. |callback| needs to be alive and also needs |
| 119 // to be destroyed so we transfer its ownership to the mojo callback. | 125 // to be destroyed so we transfer its ownership to the mojo callback. |
| 120 presentation_service_->StartSession( | 126 presentation_service_->StartSession( |
| 121 presentationUrl.utf8(), | 127 presentationUrl.utf8(), |
| 122 presentationId.utf8(), | |
| 123 base::Bind(&PresentationDispatcher::OnSessionCreated, | 128 base::Bind(&PresentationDispatcher::OnSessionCreated, |
| 124 base::Unretained(this), | 129 base::Unretained(this), |
| 125 base::Owned(callback))); | 130 base::Owned(callback))); |
| 126 } | 131 } |
| 127 | 132 |
| 128 void PresentationDispatcher::joinSession( | 133 void PresentationDispatcher::joinSession( |
| 129 const blink::WebString& presentationUrl, | 134 const blink::WebString& presentationUrl, |
| 130 const blink::WebString& presentationId, | 135 const blink::WebString& presentationId, |
| 131 blink::WebPresentationSessionClientCallbacks* callback) { | 136 blink::WebPresentationSessionClientCallbacks* callback) { |
| 132 DCHECK(callback); | 137 DCHECK(callback); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 base::Unretained(this))); | 411 base::Unretained(this))); |
| 407 | 412 |
| 408 // TODO(imcheng): Uncomment this once it is implemented on the browser | 413 // TODO(imcheng): Uncomment this once it is implemented on the browser |
| 409 // side. (crbug.com/459006) | 414 // side. (crbug.com/459006) |
| 410 // presentation_service_->ListenForSessionStateChange(base::Bind( | 415 // presentation_service_->ListenForSessionStateChange(base::Bind( |
| 411 // &PresentationDispatcher::OnSessionStateChange, | 416 // &PresentationDispatcher::OnSessionStateChange, |
| 412 // base::Unretained(this))); | 417 // base::Unretained(this))); |
| 413 } | 418 } |
| 414 | 419 |
| 415 } // namespace content | 420 } // namespace content |
| OLD | NEW |