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

Unified Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 2148643002: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix PresentationAvailabilityCallbacks Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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.
mlamouri (slow - plz ping) 2016/07/19 12:45:03 Should this be implemented first? or at least, I t
mark a. foltz 2016/07/19 17:38:47 We don't know which URL is valid yet (they all nee
mlamouri (slow - plz ping) 2016/07/20 13:02:10 Maybe the simplest change would be to pass all the
+
// 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(

Powered by Google App Engine
This is Rietveld 408576698