| 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/PushManager.h" | 6 #include "modules/push_messaging/PushManager.h" |
| 7 | 7 |
| 8 #include "bindings/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/v8/CallbackPromiseAdapter.h" |
| 9 #include "bindings/v8/NewScriptState.h" |
| 9 #include "bindings/v8/ScriptPromise.h" | 10 #include "bindings/v8/ScriptPromise.h" |
| 10 #include "bindings/v8/ScriptPromiseResolver.h" | 11 #include "bindings/v8/ScriptPromiseResolverWithContext.h" |
| 11 #include "core/dom/Document.h" | 12 #include "core/dom/Document.h" |
| 12 #include "core/dom/ExecutionContext.h" | 13 #include "core/dom/ExecutionContext.h" |
| 13 #include "modules/push_messaging/PushError.h" | 14 #include "modules/push_messaging/PushError.h" |
| 14 #include "modules/push_messaging/PushRegistration.h" | 15 #include "modules/push_messaging/PushRegistration.h" |
| 15 #include "public/platform/WebPushError.h" | 16 #include "public/platform/WebPushError.h" |
| 16 #include "wtf/OwnPtr.h" | 17 #include "wtf/OwnPtr.h" |
| 17 | 18 |
| 18 namespace WebCore { | 19 namespace WebCore { |
| 19 | 20 |
| 20 PushManager::PushManager() | 21 PushManager::PushManager() |
| 21 { | 22 { |
| 22 ScriptWrappable::init(this); | 23 ScriptWrappable::init(this); |
| 23 } | 24 } |
| 24 | 25 |
| 25 PushManager::~PushManager() | 26 PushManager::~PushManager() |
| 26 { | 27 { |
| 27 } | 28 } |
| 28 | 29 |
| 29 ScriptPromise PushManager::registerPushMessaging(ExecutionContext* context, cons
t String& senderId) | 30 ScriptPromise PushManager::registerPushMessaging(ExecutionContext* context, cons
t String& senderId) |
| 30 { | 31 { |
| 31 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(conte
xt); | 32 RefPtr<ScriptPromiseResolverWithContext> resolver = ScriptPromiseResolverWit
hContext::create(NewScriptState::current(toIsolate(context))); |
| 32 ScriptPromise promise = resolver->promise(); | 33 ScriptPromise promise = resolver->promise(); |
| 33 // FIXME: Implement registration. | 34 // FIXME: Implement registration. |
| 34 OwnPtr<CallbackPromiseAdapter<PushRegistration, PushError> > adapter = adopt
Ptr(new CallbackPromiseAdapter<PushRegistration, PushError>(resolver, context)); | 35 OwnPtr<CallbackPromiseAdapter<PushRegistration, PushError> > adapter = adopt
Ptr(new CallbackPromiseAdapter<PushRegistration, PushError>(resolver)); |
| 35 adapter->onError(new blink::WebPushError(blink::WebPushError::ErrorTypeAbort
, "FIXME")); | 36 adapter->onError(new blink::WebPushError(blink::WebPushError::ErrorTypeAbort
, "FIXME")); |
| 36 return promise; | 37 return promise; |
| 37 } | 38 } |
| 38 | 39 |
| 39 } // namespace WebCore | 40 } // namespace WebCore |
| OLD | NEW |