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

Unified Diff: Source/modules/push_messaging/PushRegistrationCallbacks.cpp

Issue 793913002: Stub implementation for PushRegistration.unregister(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@mvan_6
Patch Set: remove trace 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/push_messaging/PushRegistrationCallbacks.h ('k') | public/platform/WebPushProvider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/push_messaging/PushRegistrationCallbacks.cpp
diff --git a/Source/modules/push_messaging/PushRegistrationCallbacks.cpp b/Source/modules/push_messaging/PushRegistrationCallbacks.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e449aa5c2790625c43ed49fa67026c9954d6a731
--- /dev/null
+++ b/Source/modules/push_messaging/PushRegistrationCallbacks.cpp
@@ -0,0 +1,45 @@
+// Copyright 2014 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 "config.h"
+#include "modules/push_messaging/PushRegistrationCallbacks.h"
+
+#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "modules/push_messaging/PushError.h"
+#include "modules/push_messaging/PushRegistration.h"
+#include "modules/serviceworkers/ServiceWorkerRegistration.h"
+
+namespace blink {
+
+PushRegistrationCallbacks::PushRegistrationCallbacks(PassRefPtr<ScriptPromiseResolver> resolver, ServiceWorkerRegistration* registration)
+ : m_resolver(resolver)
+ , m_serviceWorkerRegistration(registration)
+{
+ ASSERT(m_resolver);
+ ASSERT(m_serviceWorkerRegistration);
+}
+
+PushRegistrationCallbacks::~PushRegistrationCallbacks()
+{
+}
+
+void PushRegistrationCallbacks::onSuccess(WebPushRegistration* result)
+{
+ if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped()) {
+ PushRegistration::dispose(result);
+ return;
+ }
+ m_resolver->resolve(PushRegistration::take(m_resolver.get(), result, m_serviceWorkerRegistration));
+}
+
+void PushRegistrationCallbacks::onError(WebPushError* error)
+{
+ if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped()) {
+ PushError::dispose(error);
+ return;
+ }
+ m_resolver->reject(PushError::take(m_resolver.get(), error));
+}
+
+} // namespace blink
« no previous file with comments | « Source/modules/push_messaging/PushRegistrationCallbacks.h ('k') | public/platform/WebPushProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698