Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: Source/modules/push_messaging/PushRegistration.cpp

Issue 801393002: PushRegistration.unregister() can fail with a NetworkError. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@push_unregister
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/modules/push_messaging/PushError.cpp ('k') | public/platform/WebPushError.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/serviceworkers/ServiceWorkerRegistration.h" 11 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
11 #include "public/platform/Platform.h" 12 #include "public/platform/Platform.h"
12 #include "public/platform/WebPushProvider.h" 13 #include "public/platform/WebPushProvider.h"
13 #include "public/platform/WebPushRegistration.h" 14 #include "public/platform/WebPushRegistration.h"
14 #include "wtf/OwnPtr.h" 15 #include "wtf/OwnPtr.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 PushRegistration* PushRegistration::take(ScriptPromiseResolver*, WebPushRegistra tion* pushRegistration, ServiceWorkerRegistration* serviceWorkerRegistration) 19 PushRegistration* PushRegistration::take(ScriptPromiseResolver*, WebPushRegistra tion* pushRegistration, ServiceWorkerRegistration* serviceWorkerRegistration)
19 { 20 {
(...skipping 18 matching lines...) Expand all
38 } 39 }
39 40
40 ScriptPromise PushRegistration::unregister(ScriptState* scriptState) 41 ScriptPromise PushRegistration::unregister(ScriptState* scriptState)
41 { 42 {
42 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState); 43 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scrip tState);
43 ScriptPromise promise = resolver->promise(); 44 ScriptPromise promise = resolver->promise();
44 45
45 WebPushProvider* webPushProvider = Platform::current()->pushProvider(); 46 WebPushProvider* webPushProvider = Platform::current()->pushProvider();
46 ASSERT(webPushProvider); 47 ASSERT(webPushProvider);
47 48
48 webPushProvider->unregister(m_serviceWorkerRegistration->webRegistration(), new CallbackPromiseAdapter<bool, void>(resolver)); 49 webPushProvider->unregister(m_serviceWorkerRegistration->webRegistration(), new CallbackPromiseAdapter<bool, PushError>(resolver));
49 return promise; 50 return promise;
50 } 51 }
51 52
52 void PushRegistration::trace(Visitor* visitor) 53 void PushRegistration::trace(Visitor* visitor)
53 { 54 {
54 visitor->trace(m_serviceWorkerRegistration); 55 visitor->trace(m_serviceWorkerRegistration);
55 } 56 }
56 57
57 } // namespace blink 58 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/push_messaging/PushError.cpp ('k') | public/platform/WebPushError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698