| 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 25 matching lines...) Expand all Loading... |
| 36 Member<ScriptPromiseResolver> m_resolver; | 36 Member<ScriptPromiseResolver> m_resolver; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 NavigatorShare::ShareClientImpl::ShareClientImpl( | 39 NavigatorShare::ShareClientImpl::ShareClientImpl( |
| 40 NavigatorShare* navigator_share, | 40 NavigatorShare* navigator_share, |
| 41 ScriptPromiseResolver* resolver) | 41 ScriptPromiseResolver* resolver) |
| 42 : m_navigator(navigator_share), m_resolver(resolver) {} | 42 : m_navigator(navigator_share), m_resolver(resolver) {} |
| 43 | 43 |
| 44 void NavigatorShare::ShareClientImpl::callback(const String& error) { | 44 void NavigatorShare::ShareClientImpl::callback(const String& error) { |
| 45 if (m_navigator) | 45 if (m_navigator) |
| 46 m_navigator->m_clients.remove(this); | 46 m_navigator->m_clients.erase(this); |
| 47 | 47 |
| 48 if (error.isNull()) { | 48 if (error.isNull()) { |
| 49 m_resolver->resolve(); | 49 m_resolver->resolve(); |
| 50 } else { | 50 } else { |
| 51 // TODO(mgiuca): Work out which error type to use. | 51 // TODO(mgiuca): Work out which error type to use. |
| 52 m_resolver->reject(DOMException::create(AbortError, error)); | 52 m_resolver->reject(DOMException::create(AbortError, error)); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 void NavigatorShare::ShareClientImpl::onConnectionError() { | 56 void NavigatorShare::ShareClientImpl::onConnectionError() { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 void NavigatorShare::onConnectionError() { | 129 void NavigatorShare::onConnectionError() { |
| 130 for (auto& client : m_clients) { | 130 for (auto& client : m_clients) { |
| 131 client->onConnectionError(); | 131 client->onConnectionError(); |
| 132 } | 132 } |
| 133 m_clients.clear(); | 133 m_clients.clear(); |
| 134 m_service.reset(); | 134 m_service.reset(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace blink | 137 } // namespace blink |
| OLD | NEW |