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
3 // found in the LICENSE file.
6 #include "modules/push_messaging/PushManager.h"
8 #include "bindings/v8/CallbackPromiseAdapter.h"
9 #include "bindings/v8/ScriptPromise.h"
10 #include "bindings/v8/ScriptPromiseResolverWithContext.h"
11 #include "bindings/v8/ScriptState.h"
12 #include "core/dom/Document.h"
13 #include "core/dom/ExecutionContext.h"
14 #include "modules/push_messaging/PushError.h"
15 #include "modules/push_messaging/PushRegistration.h"
16 #include "public/platform/WebPushError.h"
17 #include "wtf/OwnPtr.h"
21 PushManager::PushManager()
23 ScriptWrappable::init(this);
26 PushManager::~PushManager()
30 ScriptPromise PushManager::registerPushMessaging(ExecutionContext* context, const String& senderId)
32 RefPtr<ScriptPromiseResolverWithContext> resolver = ScriptPromiseResolverWithContext::create(ScriptState::current(toIsolate(context)));
33 ScriptPromise promise = resolver->promise();
34 // FIXME: Implement registration.
35 OwnPtr<CallbackPromiseAdapter<PushRegistration, PushError> > adapter = adoptPtr(new CallbackPromiseAdapter<PushRegistration, PushError>(resolver));
36 adapter->onError(new blink::WebPushError(blink::WebPushError::ErrorTypeAbort, "FIXME"));
40 } // namespace WebCore