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

Unified Diff: Source/bindings/modules/v8/custom/V8NotificationCustom.cpp

Issue 993893002: Add the data attribute to the Notification object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: [WIP] modified wrong comment. Created 5 years, 9 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: Source/bindings/modules/v8/custom/V8NotificationCustom.cpp
diff --git a/Source/bindings/modules/v8/custom/V8NotificationCustom.cpp b/Source/bindings/modules/v8/custom/V8NotificationCustom.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9c109cc7a0e09db97832d95c0bb8a8a503c47bf8
--- /dev/null
+++ b/Source/bindings/modules/v8/custom/V8NotificationCustom.cpp
@@ -0,0 +1,27 @@
+// Copyright 2015 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 "bindings/modules/v8/V8Notification.h"
+
+#include "bindings/core/v8/SerializedScriptValue.h"
+#include "modules/notifications/Notification.h"
+
+namespace blink {
+
+void V8Notification::dataAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ v8::Local<v8::Object> holder = info.Holder();
+ Notification* impl = V8Notification::toImpl(holder);
+ v8::Handle<v8::Value> result;
+
+ if (impl->data())
+ result = impl->data()->deserialize(info.GetIsolate());
+ else
+ result = v8::Null(info.GetIsolate());
+
+ v8SetReturnValue(info, result);
Peter Beverloo 2015/03/10 23:34:26 I'm not too familiar with custom bindings, but as
Sanghyun Park 2015/03/11 10:59:52 Your suggestion codes are more clean than this. I'
+}
+
+}
Peter Beverloo 2015/03/10 23:34:26 micro nit: // namespace blink
Sanghyun Park 2015/03/11 10:59:51 Done.

Powered by Google App Engine
This is Rietveld 408576698