OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/webshare/NavigatorShare.h" | 5 #include "modules/webshare/NavigatorShare.h" |
6 | 6 |
7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 DCHECK(frame); | 97 DCHECK(frame); |
98 frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); | 98 frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); |
99 DCHECK(m_service); | 99 DCHECK(m_service); |
100 } | 100 } |
101 | 101 |
102 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; | 102 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; |
103 ShareClientImpl* client = new ShareClientImpl(this, resolver); | 103 ShareClientImpl* client = new ShareClientImpl(this, resolver); |
104 m_clients.add(client); | 104 m_clients.add(client); |
105 ScriptPromise promise = resolver->promise(); | 105 ScriptPromise promise = resolver->promise(); |
106 | 106 |
107 // TODO(sammc): Use shareData.url(). | 107 m_service->Share( |
108 m_service->Share(shareData.hasTitle() ? shareData.title() : emptyString(), s hareData.hasText() ? shareData.text() : emptyString(), convertToBaseCallback(WTF ::bind(&ShareClientImpl::callback, wrapPersistent(client)))); | 108 shareData.hasTitle() ? shareData.title() : emptyString(), |
109 shareData.hasText() ? shareData.text() : emptyString(), | |
110 shareData.hasURL() ? KURL(scriptState->getExecutionContext()->url(), sha reData.url()) : KURL(), | |
dcheng
2016/09/08 03:17:37
Should this be using doc->completeURL(shareData.ur
Sam McNally
2016/09/08 03:32:05
Done.
| |
111 convertToBaseCallback(WTF::bind(&ShareClientImpl::callback, wrapPersiste nt(client)))); | |
109 | 112 |
110 return promise; | 113 return promise; |
111 } | 114 } |
112 | 115 |
113 ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigat or, const ShareData& shareData) | 116 ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigat or, const ShareData& shareData) |
114 { | 117 { |
115 return from(navigator).share(scriptState, shareData); | 118 return from(navigator).share(scriptState, shareData); |
116 } | 119 } |
117 | 120 |
118 } // namespace blink | 121 } // namespace blink |
OLD | NEW |