OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "modules/push_messaging/PushRegistration.h" | 6 #include "modules/push_messaging/PushRegistration.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "modules/push_messaging/PushError.h" | 10 #include "modules/push_messaging/PushError.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 , m_serviceWorkerRegistration(serviceWorkerRegistration) | 33 , m_serviceWorkerRegistration(serviceWorkerRegistration) |
34 { | 34 { |
35 } | 35 } |
36 | 36 |
37 PushRegistration::~PushRegistration() | 37 PushRegistration::~PushRegistration() |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 ScriptPromise PushRegistration::unregister(ScriptState* scriptState) | 41 ScriptPromise PushRegistration::unregister(ScriptState* scriptState) |
42 { | 42 { |
43 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip
tState); | 43 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::
create(scriptState); |
44 ScriptPromise promise = resolver->promise(); | 44 ScriptPromise promise = resolver->promise(); |
45 | 45 |
46 WebPushProvider* webPushProvider = Platform::current()->pushProvider(); | 46 WebPushProvider* webPushProvider = Platform::current()->pushProvider(); |
47 ASSERT(webPushProvider); | 47 ASSERT(webPushProvider); |
48 | 48 |
49 webPushProvider->unregister(m_serviceWorkerRegistration->webRegistration(),
new CallbackPromiseAdapter<bool, PushError>(resolver)); | 49 webPushProvider->unregister(m_serviceWorkerRegistration->webRegistration(),
new CallbackPromiseAdapter<bool, PushError>(resolver)); |
50 return promise; | 50 return promise; |
51 } | 51 } |
52 | 52 |
53 void PushRegistration::trace(Visitor* visitor) | 53 void PushRegistration::trace(Visitor* visitor) |
54 { | 54 { |
55 visitor->trace(m_serviceWorkerRegistration); | 55 visitor->trace(m_serviceWorkerRegistration); |
56 } | 56 } |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
OLD | NEW |