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

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

Issue 2174693004: [Presentation API] Add support to content/ for multiple URLs per PresentationRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing TODO 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 293b030a88d9bfd911a4f29983d88b82e5d1d423..8485ba1feab8cb7f62e2885c11713b0e9b749bb4 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,37 +100,41 @@ void PresentationDispatcher::setController(
}
void PresentationDispatcher::startSession(
- const blink::WebString& presentationUrl,
+ const blink::WebVector<blink::WebString>& presentationUrls,
blink::WebPresentationConnectionClientCallbacks* callback) {
DCHECK(callback);
ConnectToPresentationServiceIfNeeded();
+ std::vector<std::string> urls(presentationUrls.size());
+ std::transform(presentationUrls.begin(), presentationUrls.end(), urls.begin(),
+ [](const blink::WebString& url) { return url.utf8(); });
+
// 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(),
- base::Bind(&PresentationDispatcher::OnSessionCreated,
- base::Unretained(this),
- base::Owned(callback)));
+ urls, 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();
+ std::vector<std::string> urls(presentationUrls.size());
+ std::transform(presentationUrls.begin(), presentationUrls.end(), urls.begin(),
+ [](const blink::WebString& url) { return url.utf8(); });
+
// 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(),
- presentationId.utf8(),
+ urls, presentationId.utf8(),
base::Bind(&PresentationDispatcher::OnSessionCreated,
- base::Unretained(this),
- base::Owned(callback)));
+ base::Unretained(this), base::Owned(callback)));
}
void PresentationDispatcher::sendString(
@@ -290,10 +294,14 @@ void PresentationDispatcher::stopListening(
UpdateListeningState(status_it->second.get());
}
-void PresentationDispatcher::setDefaultPresentationUrl(
- const blink::WebString& url) {
+void PresentationDispatcher::setDefaultPresentationUrls(
+ const blink::WebVector<blink::WebString>& presentationUrls) {
ConnectToPresentationServiceIfNeeded();
- presentation_service_->SetDefaultPresentationURL(url.utf8());
+
+ std::vector<std::string> urls(presentationUrls.size());
+ std::transform(presentationUrls.begin(), presentationUrls.end(), urls.begin(),
+ [](const blink::WebString& url) { return url.utf8(); });
+ presentation_service_->SetDefaultPresentationUrls(urls);
}
void PresentationDispatcher::DidCommitProvisionalLoad(

Powered by Google App Engine
This is Rietveld 408576698