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

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: Add comments on ownership in PushPermissionRequestCallback. 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..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())
+ return 0;
Mike West 2014/11/06 15:37:14 s/0/nullptr/g
Michael van Ouwerkerk 2014/11/06 15:41:13 Done.
+
+ const Document* document = toDocument(context);
+ ASSERT(document->frame());
+
+ if (!document->frame()->isLocalFrame())
+ return 0;
Mike West 2014/11/06 15:37:14 Ditto.
Michael van Ouwerkerk 2014/11/06 15:41:13 Done.
+
+ 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