| 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 m_service->Share( | 107 // TODO(sammc): Use shareData.url(). |
| 108 shareData.hasTitle() ? shareData.title() : emptyString(), | 108 m_service->Share(shareData.hasTitle() ? shareData.title() : emptyString(), s
hareData.hasText() ? shareData.text() : emptyString(), convertToBaseCallback(WTF
::bind(&ShareClientImpl::callback, wrapPersistent(client)))); |
| 109 shareData.hasText() ? shareData.text() : emptyString(), | |
| 110 doc->completeURL(shareData.url()), | |
| 111 convertToBaseCallback(WTF::bind(&ShareClientImpl::callback, wrapPersiste
nt(client)))); | |
| 112 | 109 |
| 113 return promise; | 110 return promise; |
| 114 } | 111 } |
| 115 | 112 |
| 116 ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigat
or, const ShareData& shareData) | 113 ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigat
or, const ShareData& shareData) |
| 117 { | 114 { |
| 118 return from(navigator).share(scriptState, shareData); | 115 return from(navigator).share(scriptState, shareData); |
| 119 } | 116 } |
| 120 | 117 |
| 121 } // namespace blink | 118 } // namespace blink |
| OLD | NEW |