blob: 97ee49615250a2064acf5c7390376694e69a27ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "modules/permissions/PermissionCallback.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "modules/permissions/PermissionStatus.h"
namespace blink {
PermissionCallback::PermissionCallback(ScriptPromiseResolver* resolver, WebPermissionType permissionType)
: m_resolver(resolver)
, m_permissionType(permissionType)
{
ASSERT(m_resolver);
}
PermissionCallback::~PermissionCallback()
{
}
void PermissionCallback::onSuccess(WebPermissionStatus permissionStatus)
{
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped()) {
return;
}
m_resolver->resolve(PermissionStatus::take(m_resolver.get(), permissionStatus, m_permissionType));
}
void PermissionCallback::onError()
{
if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped()) {
return;
}
m_resolver->reject();
}
} // namespace blink
|