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

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: Updated unittests. 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..45c4e74b482a3dbda81e2011ed5d1778ad733950 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,42 @@ void PresentationDispatcher::setController(
}
void PresentationDispatcher::startSession(
- const blink::WebString& presentationUrl,
+ const blink::WebVector<blink::WebString>& presentationUrls,
blink::WebPresentationConnectionClientCallbacks* callback) {
DCHECK(callback);
ConnectToPresentationServiceIfNeeded();
+ mojo::Array<mojo::String> urls(presentationUrls.size());
+ for (size_t i = 0; i < presentationUrls.size(); ++i)
+ urls[i] = presentationUrls[i].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(),
+ std::move(urls),
base::Bind(&PresentationDispatcher::OnSessionCreated,
- base::Unretained(this),
- base::Owned(callback)));
+ 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();
+ mojo::Array<mojo::String> urls(presentationUrls.size());
+ for (size_t i = 0; i < presentationUrls.size(); ++i)
+ urls[i] = presentationUrls[i].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(),
+ std::move(urls), presentationId.utf8(),
base::Bind(&PresentationDispatcher::OnSessionCreated,
- base::Unretained(this),
- base::Owned(callback)));
+ base::Unretained(this), base::Owned(callback)));
}
void PresentationDispatcher::sendString(
@@ -290,10 +295,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());
+ mojo::Array<mojo::String> urls(presentationUrls.size());
+ for (size_t i = 0; i < presentationUrls.size(); ++i)
+ urls[i] = presentationUrls[i].utf8();
+
+ presentation_service_->SetDefaultPresentationUrls(std::move(urls));
}
void PresentationDispatcher::DidCommitProvisionalLoad(

Powered by Google App Engine
This is Rietveld 408576698