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/PresentationAvailabilityCallback.h" |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "modules/presentation/PresentationAvailability.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 PresentationAvailabilityCallback::PresentationAvailabilityCallback(PassRefPtr<Sc
riptPromiseResolver> resolver) |
| 14 : m_resolver(resolver) |
| 15 { |
| 16 ASSERT(m_resolver); |
| 17 } |
| 18 |
| 19 void PresentationAvailabilityCallback::onSuccess(bool* result) |
| 20 { |
| 21 OwnPtr<bool> availability = adoptPtr(result); |
| 22 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
| 23 return; |
| 24 m_resolver->resolve(PresentationAvailability::take(m_resolver.get(), *availa
bility)); |
| 25 } |
| 26 |
| 27 void PresentationAvailabilityCallback::onError() |
| 28 { |
| 29 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
| 30 return; |
| 31 m_resolver->reject(); |
| 32 } |
| 33 |
| 34 } // namespace blink |
OLD | NEW |