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

Unified Diff: third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp

Issue 2207343002: Update navigator.share API to match draft specs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
diff --git a/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp b/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
index 7f192c704194993e5cdb393f5b9b57b912fac7cd..6e4bba14596b7147ffc6f9577a0694a049f2814a 100644
--- a/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
+++ b/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
@@ -9,6 +9,7 @@
#include "core/dom/ExceptionCode.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Navigator.h"
+#include "modules/webshare/ShareData.h"
#include "platform/mojo/MojoHelper.h"
#include "public/platform/InterfaceProvider.h"
#include "public/platform/Platform.h"
@@ -78,7 +79,7 @@ const char* NavigatorShare::supplementName()
return "NavigatorShare";
}
-ScriptPromise NavigatorShare::share(ScriptState* scriptState, const String& title, const String& text)
+ScriptPromise NavigatorShare::share(ScriptState* scriptState, const ShareData& shareData)
{
if (!m_service) {
Document* doc = toDocument(scriptState->getExecutionContext());
@@ -94,14 +95,15 @@ ScriptPromise NavigatorShare::share(ScriptState* scriptState, const String& titl
m_clients.add(client);
ScriptPromise promise = resolver->promise();
- m_service->Share(title, text, convertToBaseCallback(WTF::bind(&ShareClientImpl::callback, wrapPersistent(client))));
+ // TODO(sammc): Use shareData.url().
+ m_service->Share(shareData.hasTitle() ? shareData.title() : emptyString(), shareData.hasText() ? shareData.text() : emptyString(), convertToBaseCallback(WTF::bind(&ShareClientImpl::callback, wrapPersistent(client))));
return promise;
}
-ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigator, const String& title, const String& text)
+ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigator, const ShareData& shareData)
{
- return from(navigator).share(scriptState, title, text);
+ return from(navigator).share(scriptState, shareData);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698