Chromium Code Reviews| Index: Source/modules/push_messaging/PushPermissionClient.cpp |
| diff --git a/Source/modules/push_messaging/PushPermissionClient.cpp b/Source/modules/push_messaging/PushPermissionClient.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c3c02aa506847c4f19b98d5431635bd41b19f2f0 |
| --- /dev/null |
| +++ b/Source/modules/push_messaging/PushPermissionClient.cpp |
| @@ -0,0 +1,38 @@ |
| +// 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/PushPermissionClient.h" |
| + |
| +#include "core/dom/Document.h" |
| +#include "core/dom/ExecutionContext.h" |
| +#include "core/frame/LocalFrame.h" |
| + |
| +namespace blink { |
| + |
| +const char* PushPermissionClient::supplementName() |
| +{ |
| + return "PushPermissionClient"; |
| +} |
| + |
| +PushPermissionClient* PushPermissionClient::from(ExecutionContext* context) |
| +{ |
| + if (!context->isDocument()) |
|
Mike West
2014/11/06 14:21:20
Hrm. Isn't this sort of thing supposed to work ins
Michael van Ouwerkerk
2014/11/06 14:59:46
No, this is exactly the part that cannot work insi
|
| + return 0; |
| + |
| + const Document* document = toDocument(context); |
| + ASSERT(document->frame()); |
| + |
| + if (!document->frame()->isLocalFrame()) |
|
Mike West
2014/11/06 14:21:20
Can you add a FIXME to support RemoteFrames? (Or p
Michael van Ouwerkerk
2014/11/06 14:59:46
Isn't returning null sufficient? I'm not sure we'd
|
| + return 0; |
| + |
| + return static_cast<PushPermissionClient*>(WillBeHeapSupplement<LocalFrame>::from(document->frame(), supplementName())); |
| +} |
| + |
| +void providePushPermissionClientTo(LocalFrame& frame, PassOwnPtrWillBeRawPtr<PushPermissionClient> client) |
| +{ |
| + frame.provideSupplement(PushPermissionClient::supplementName(), client); |
| +} |
| + |
| +} |