Chromium Code Reviews| Index: content/renderer/presentation/presentation_dispatcher.cc |
| diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc |
| index e9360099ed0a640a7a16f30f4f2eec8e299407c5..aa4633e3d456e3444a30c775018068f363355fb6 100644 |
| --- a/content/renderer/presentation/presentation_dispatcher.cc |
| +++ b/content/renderer/presentation/presentation_dispatcher.cc |
| @@ -16,7 +16,7 @@ |
| #include "content/renderer/presentation/presentation_connection_client.h" |
| #include "services/shell/public/cpp/interface_provider.h" |
| #include "third_party/WebKit/public/platform/WebString.h" |
| -#include "third_party/WebKit/public/platform/WebURL.h" |
| +#include "third_party/WebKit/public/platform/WebVector.h" |
| #include "third_party/WebKit/public/platform/modules/presentation/WebPresentationAvailabilityObserver.h" |
| #include "third_party/WebKit/public/platform/modules/presentation/WebPresentationController.h" |
| #include "third_party/WebKit/public/platform/modules/presentation/WebPresentationError.h" |
| @@ -100,33 +100,37 @@ void PresentationDispatcher::setController( |
| } |
| void PresentationDispatcher::startSession( |
| - const blink::WebString& presentationUrl, |
| + const blink::WebVector<blink::WebString>& presentationUrls, |
| blink::WebPresentationConnectionClientCallbacks* callback) { |
| DCHECK(callback); |
| ConnectToPresentationServiceIfNeeded(); |
| + // TODO(mfoltz): Pass all URLs to PresentationService. |
| + |
|
imcheng
2016/07/20 17:20:46
should this code check the given vector is not emp
|
| // The dispatcher owns the service so |this| will be valid when |
| // OnSessionCreated() is called. |callback| needs to be alive and also needs |
| // to be destroyed so we transfer its ownership to the mojo callback. |
| presentation_service_->StartSession( |
| - presentationUrl.utf8(), |
| + presentationUrls[0].utf8(), |
| base::Bind(&PresentationDispatcher::OnSessionCreated, |
| base::Unretained(this), |
| base::Owned(callback))); |
| } |
| void PresentationDispatcher::joinSession( |
| - const blink::WebString& presentationUrl, |
| + const blink::WebVector<blink::WebString>& presentationUrls, |
| const blink::WebString& presentationId, |
| blink::WebPresentationConnectionClientCallbacks* callback) { |
| DCHECK(callback); |
| ConnectToPresentationServiceIfNeeded(); |
| + // TODO(mfoltz): Pass all URLs to PresentationService. |
| + |
| // The dispatcher owns the service so |this| will be valid when |
| // OnSessionCreated() is called. |callback| needs to be alive and also needs |
| // to be destroyed so we transfer its ownership to the mojo callback. |
| presentation_service_->JoinSession( |
| - presentationUrl.utf8(), |
| + presentationUrls[0].utf8(), |
| presentationId.utf8(), |
| base::Bind(&PresentationDispatcher::OnSessionCreated, |
| base::Unretained(this), |
| @@ -241,9 +245,10 @@ void PresentationDispatcher::terminateSession( |
| } |
| void PresentationDispatcher::getAvailability( |
| - const blink::WebString& availabilityUrl, |
| + const blink::WebVector<blink::WebString>& availabilityUrls, |
| blink::WebPresentationAvailabilityCallbacks* callbacks) { |
| - const std::string& availability_url = availabilityUrl.utf8(); |
| + // TODO(mfoltz): Pass all URLs to PresentationService. |
| + const std::string& availability_url = availabilityUrls[0].utf8(); |
| AvailabilityStatus* status = nullptr; |
| auto status_it = availability_status_.find(availability_url); |
| if (status_it == availability_status_.end()) { |
| @@ -266,7 +271,8 @@ void PresentationDispatcher::getAvailability( |
| void PresentationDispatcher::startListening( |
| blink::WebPresentationAvailabilityObserver* observer) { |
| - const std::string& availability_url = observer->url().string().utf8(); |
| + // TODO(mfoltz): Pass all URLs to PresentationService. |
| + const std::string& availability_url = observer->urls()[0].string().utf8(); |
| auto status_it = availability_status_.find(availability_url); |
| if (status_it == availability_status_.end()) { |
| DLOG(WARNING) << "Start listening for availability for unknown URL " |
| @@ -279,7 +285,8 @@ void PresentationDispatcher::startListening( |
| void PresentationDispatcher::stopListening( |
| blink::WebPresentationAvailabilityObserver* observer) { |
| - const std::string& availability_url = observer->url().string().utf8(); |
| + // TODO(mfoltz): Pass all URLs to PresentationService. |
| + const std::string& availability_url = observer->urls()[0].string().utf8(); |
| auto status_it = availability_status_.find(availability_url); |
| if (status_it == availability_status_.end()) { |
| DLOG(WARNING) << "Stop listening for availability for unknown URL " |
| @@ -290,10 +297,11 @@ void PresentationDispatcher::stopListening( |
| UpdateListeningState(status_it->second.get()); |
| } |
| -void PresentationDispatcher::setDefaultPresentationUrl( |
| - const blink::WebString& url) { |
| +void PresentationDispatcher::setDefaultPresentationUrls( |
| + const blink::WebVector<blink::WebString>& urls) { |
| ConnectToPresentationServiceIfNeeded(); |
| - presentation_service_->SetDefaultPresentationURL(url.utf8()); |
| + // TODO(mfoltz): Pass all URLs to PresentationService. |
| + presentation_service_->SetDefaultPresentationURL(urls[0].utf8()); |
| } |
| void PresentationDispatcher::DidCommitProvisionalLoad( |