| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 std::swap(message_request_queue_, empty); | 198 std::swap(message_request_queue_, empty); |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 | 201 |
| 202 message_request_queue_.pop(); | 202 message_request_queue_.pop(); |
| 203 if (!message_request_queue_.empty()) { | 203 if (!message_request_queue_.empty()) { |
| 204 DoSendMessage(message_request_queue_.front().get()); | 204 DoSendMessage(message_request_queue_.front().get()); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 void PresentationDispatcher::terminateSession( | 208 void PresentationDispatcher::closeSession( |
| 209 const blink::WebString& presentationUrl, | 209 const blink::WebString& presentationUrl, |
| 210 const blink::WebString& presentationId) { | 210 const blink::WebString& presentationId) { |
| 211 ConnectToPresentationServiceIfNeeded(); | 211 ConnectToPresentationServiceIfNeeded(); |
| 212 | 212 |
| 213 presentation_service_->CloseSession( | 213 presentation_service_->CloseSession( |
| 214 presentationUrl.utf8(), | 214 presentationUrl.utf8(), |
| 215 presentationId.utf8()); | 215 presentationId.utf8()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void PresentationDispatcher::terminateSession( |
| 219 const blink::WebString& presentationUrl, |
| 220 const blink::WebString& presentationId) { |
| 221 ConnectToPresentationServiceIfNeeded(); |
| 222 |
| 223 presentation_service_->TerminateSession( |
| 224 presentationUrl.utf8(), |
| 225 presentationId.utf8()); |
| 226 } |
| 227 |
| 218 void PresentationDispatcher::getAvailability( | 228 void PresentationDispatcher::getAvailability( |
| 219 const blink::WebString& availabilityUrl, | 229 const blink::WebString& availabilityUrl, |
| 220 blink::WebPresentationAvailabilityCallbacks* callbacks) { | 230 blink::WebPresentationAvailabilityCallbacks* callbacks) { |
| 221 const std::string& availability_url = availabilityUrl.utf8(); | 231 const std::string& availability_url = availabilityUrl.utf8(); |
| 222 AvailabilityStatus* status = nullptr; | 232 AvailabilityStatus* status = nullptr; |
| 223 auto status_it = availability_status_.find(availability_url); | 233 auto status_it = availability_status_.find(availability_url); |
| 224 if (status_it == availability_status_.end()) { | 234 if (status_it == availability_status_.end()) { |
| 225 status = new AvailabilityStatus(availability_url); | 235 status = new AvailabilityStatus(availability_url); |
| 226 availability_status_[availability_url] = make_scoped_ptr(status); | 236 availability_status_[availability_url] = make_scoped_ptr(status); |
| 227 } else { | 237 } else { |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( | 502 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( |
| 493 const std::string& availability_url) | 503 const std::string& availability_url) |
| 494 : url(availability_url), | 504 : url(availability_url), |
| 495 last_known_availability(false), | 505 last_known_availability(false), |
| 496 listening_state(ListeningState::INACTIVE) {} | 506 listening_state(ListeningState::INACTIVE) {} |
| 497 | 507 |
| 498 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { | 508 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { |
| 499 } | 509 } |
| 500 | 510 |
| 501 } // namespace content | 511 } // namespace content |
| OLD | NEW |