Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "modules/presentation/PresentationSessionClientCallbacks.h" | |
| 7 | |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | |
| 9 #include "core/dom/DOMException.h" | |
| 10 #include "core/dom/ExceptionCode.h" | |
| 11 #include "modules/presentation/Presentation.h" | |
| 12 #include "modules/presentation/PresentationSession.h" | |
| 13 #include "public/platform/WebString.h" | |
| 14 #include "public/platform/modules/presentation/WebPresentationError.h" | |
| 15 | |
| 16 namespace blink { | |
| 17 | |
| 18 PresentationSessionClientCallbacks::PresentationSessionClientCallbacks( | |
| 19 PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver, | |
| 20 Presentation* presentation) | |
| 21 : m_resolver(resolver) | |
| 22 , m_presentation(presentation) | |
| 23 { | |
| 24 ASSERT(m_resolver); | |
| 25 ASSERT(m_presentation); | |
| 26 } | |
| 27 | |
| 28 PresentationSessionClientCallbacks::~PresentationSessionClientCallbacks() | |
| 29 { | |
| 30 } | |
| 31 | |
| 32 void PresentationSessionClientCallbacks::onSuccess(WebString* id) | |
| 33 { | |
| 34 ASSERT(id); | |
| 35 if (m_resolver->executionContext() && !m_resolver->executionContext()->activ eDOMObjectsAreStopped()) { | |
| 36 PresentationSession* session = PresentationSession::create(m_presentatio n->frame(), *id); | |
|
mlamouri (slow - plz ping)
2015/02/26 10:57:03
Could you use ::dispose() and ::take() methods?
whywhat
2015/02/26 15:50:54
Sorry, there's no way I'm creating a PresentationS
| |
| 37 m_presentation->didCreateSession(session); | |
| 38 m_resolver->resolve(session); | |
| 39 } | |
| 40 delete id; | |
| 41 } | |
| 42 | |
| 43 void PresentationSessionClientCallbacks::onError(WebPresentationError* error) | |
| 44 { | |
| 45 ASSERT(error); | |
| 46 if (m_resolver->executionContext() && !m_resolver->executionContext()->activ eDOMObjectsAreStopped()) { | |
| 47 // TODO(avayvod): figure out the mapping between WebPresentationError an d | |
| 48 // DOMException error codes. | |
| 49 m_resolver->reject(DOMException::create(InvalidAccessError, error->messa ge)); | |
|
mlamouri (slow - plz ping)
2015/02/26 10:57:03
ditto
whywhat
2015/02/26 15:50:54
Any suggestions on mapping WebPresentationError to
| |
| 50 } | |
| 51 delete error; | |
| 52 } | |
| 53 | |
| 54 } // namespace blink | |
| OLD | NEW |