OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/permissions/PermissionCallback.h" | 5 #include "modules/permissions/PermissionCallback.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "modules/permissions/PermissionStatus.h" | 8 #include "modules/permissions/PermissionStatus.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 PermissionCallback::PermissionCallback(ScriptPromiseResolver* resolver, WebPermi
ssionType permissionType) | 12 PermissionCallback::PermissionCallback(ScriptPromiseResolver* resolver, WebPermi
ssionType permissionType) |
13 : m_resolver(resolver) | 13 : m_resolver(resolver) |
14 , m_permissionType(permissionType) | 14 , m_permissionType(permissionType) |
15 { | 15 { |
16 ASSERT(m_resolver); | 16 ASSERT(m_resolver); |
17 } | 17 } |
18 | 18 |
19 PermissionCallback::~PermissionCallback() | 19 PermissionCallback::~PermissionCallback() |
20 { | 20 { |
21 } | 21 } |
22 | 22 |
23 void PermissionCallback::onSuccess(WebPermissionStatus permissionStatus) | 23 void PermissionCallback::onSuccess(WebPermissionStatus permissionStatus) |
24 { | 24 { |
25 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 25 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()-
>activeDOMObjectsAreStopped()) { |
26 return; | 26 return; |
27 } | 27 } |
28 m_resolver->resolve(PermissionStatus::take(m_resolver.get(), permissionStatu
s, m_permissionType)); | 28 m_resolver->resolve(PermissionStatus::take(m_resolver.get(), permissionStatu
s, m_permissionType)); |
29 } | 29 } |
30 | 30 |
31 void PermissionCallback::onError() | 31 void PermissionCallback::onError() |
32 { | 32 { |
33 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) { | 33 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()-
>activeDOMObjectsAreStopped()) { |
34 return; | 34 return; |
35 } | 35 } |
36 m_resolver->reject(); | 36 m_resolver->reject(); |
37 } | 37 } |
38 | 38 |
39 } // namespace blink | 39 } // namespace blink |
OLD | NEW |