| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 SecurityError, | 93 SecurityError, |
| 94 "Must be handling a user gesture to perform a share request."); | 94 "Must be handling a user gesture to perform a share request."); |
| 95 return ScriptPromise::rejectWithDOMException(scriptState, error); | 95 return ScriptPromise::rejectWithDOMException(scriptState, error); |
| 96 } | 96 } |
| 97 | 97 |
| 98 Document* doc = toDocument(scriptState->getExecutionContext()); | 98 Document* doc = toDocument(scriptState->getExecutionContext()); |
| 99 DCHECK(doc); | 99 DCHECK(doc); |
| 100 if (!m_service) { | 100 if (!m_service) { |
| 101 LocalFrame* frame = doc->frame(); | 101 LocalFrame* frame = doc->frame(); |
| 102 DCHECK(frame); | 102 DCHECK(frame); |
| 103 frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); | 103 frame->interfaceProvider()->getInterface(mojo::MakeRequest(&m_service)); |
| 104 m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind( | 104 m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind( |
| 105 &NavigatorShare::onConnectionError, wrapWeakPersistent(this)))); | 105 &NavigatorShare::onConnectionError, wrapWeakPersistent(this)))); |
| 106 DCHECK(m_service); | 106 DCHECK(m_service); |
| 107 } | 107 } |
| 108 | 108 |
| 109 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 109 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 110 ShareClientImpl* client = new ShareClientImpl(this, resolver); | 110 ShareClientImpl* client = new ShareClientImpl(this, resolver); |
| 111 m_clients.add(client); | 111 m_clients.add(client); |
| 112 ScriptPromise promise = resolver->promise(); | 112 ScriptPromise promise = resolver->promise(); |
| 113 | 113 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 for (auto& client : m_clients) { | 135 for (auto& client : m_clients) { |
| 136 client->onConnectionError(); | 136 client->onConnectionError(); |
| 137 } | 137 } |
| 138 m_clients.clear(); | 138 m_clients.clear(); |
| 139 m_service.reset(); | 139 m_service.reset(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |