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

Unified Diff: third_party/WebKit/Source/modules/push_messaging/PushSubscriptionOptions.h

Issue 2133673002: Push API: Implement and ship PushSubscription.options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add MODULES_EXPORT Created 4 years, 5 months 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: third_party/WebKit/Source/modules/push_messaging/PushSubscriptionOptions.h
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionOptions.h b/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionOptions.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a1929e8edb6e9ab9b51213bd96c6abeef5ee547
--- /dev/null
+++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionOptions.h
@@ -0,0 +1,48 @@
+// Copyright 2016 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.
+
+#ifndef PushSubscriptionOptions_h
+#define PushSubscriptionOptions_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "modules/ModulesExport.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class DOMArrayBuffer;
+class ExceptionState;
+class PushSubscriptionOptionsInit;
+struct WebPushSubscriptionOptions;
+
+class PushSubscriptionOptions final : public GarbageCollected<PushSubscriptionOptions>, public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+public:
+ // Converts developer-provided dictionary to WebPushSubscriptionOptions.
+ // Throws if applicationServerKey is invalid.
+ MODULES_EXPORT static WebPushSubscriptionOptions toWeb(const PushSubscriptionOptionsInit&, ExceptionState&);
+
+ static PushSubscriptionOptions* create(const WebPushSubscriptionOptions& options)
+ {
+ return new PushSubscriptionOptions(options);
+ }
+
+ bool userVisibleOnly() const { return m_userVisibleOnly; }
+
+ // Mutable by web developer. See https://github.com/w3c/push-api/issues/198.
+ DOMArrayBuffer* applicationServerKey() const { return m_applicationServerKey; }
+
+ DECLARE_TRACE();
+
+private:
+ explicit PushSubscriptionOptions(const WebPushSubscriptionOptions&);
+
+ bool m_userVisibleOnly;
+ Member<DOMArrayBuffer> m_applicationServerKey;
+};
+
+} // namespace blink
+
+#endif // PushSubscriptionOptions_h

Powered by Google App Engine
This is Rietveld 408576698