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

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

Issue 707833002: Plumb Push API permission request through Blink using Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use nullptr instead of 0. Created 6 years, 1 month 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
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..e0bcdabd0149017715b2edc5d9889fc45632715f
--- /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())
+ return nullptr;
+
+ const Document* document = toDocument(context);
+ ASSERT(document->frame());
+
+ if (!document->frame()->isLocalFrame())
+ return nullptr;
+
+ return static_cast<PushPermissionClient*>(WillBeHeapSupplement<LocalFrame>::from(document->frame(), supplementName()));
+}
+
+void providePushPermissionClientTo(LocalFrame& frame, PassOwnPtrWillBeRawPtr<PushPermissionClient> client)
+{
+ frame.provideSupplement(PushPermissionClient::supplementName(), client);
+}
+
+}
« no previous file with comments | « Source/modules/push_messaging/PushPermissionClient.h ('k') | Source/modules/push_messaging/PushPermissionRequestCallback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698