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

Unified Diff: Source/modules/notifications/Notification.cpp

Issue 556193002: Add NotificationOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@dic-webmidi
Patch Set: Created 6 years, 3 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/modules/notifications/Notification.cpp
diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
index 6ec559fb0558430e9cf9abea69cbb7d2350b68ea..99a21b58cacc03693540163fb483af9901b1cee4 100644
--- a/Source/modules/notifications/Notification.cpp
+++ b/Source/modules/notifications/Notification.cpp
@@ -31,7 +31,6 @@
#include "config.h"
#include "modules/notifications/Notification.h"
-#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/dom/Document.h"
#include "core/events/Event.h"
@@ -39,26 +38,24 @@
#include "core/page/WindowFocusAllowedIndicator.h"
#include "modules/notifications/NotificationClient.h"
#include "modules/notifications/NotificationController.h"
+#include "modules/notifications/NotificationOptions.h"
#include "modules/notifications/NotificationPermissionClient.h"
namespace blink {
-Notification* Notification::create(ExecutionContext* context, const String& title, const Dictionary& options)
+Notification* Notification::create(ExecutionContext* context, const String& title, const NotificationOptions* options)
{
NotificationClient& client = NotificationController::clientFrom(context);
Notification* notification = adoptRefCountedGarbageCollectedWillBeNoop(new Notification(title, context, &client));
- String argument;
- if (DictionaryHelper::get(options, "body", argument))
- notification->setBody(argument);
- if (DictionaryHelper::get(options, "tag", argument))
- notification->setTag(argument);
- if (DictionaryHelper::get(options, "lang", argument))
- notification->setLang(argument);
- if (DictionaryHelper::get(options, "dir", argument))
- notification->setDir(argument);
- if (DictionaryHelper::get(options, "icon", argument)) {
- KURL iconUrl = argument.isEmpty() ? KURL() : context->completeURL(argument);
+ if (options->hasBody())
Peter Beverloo 2014/09/10 14:30:34 The specification defines "tag" and "body" as defa
bashi 2014/09/10 15:02:01 Done. I was looking at http://www.w3.org/TR/notifi
+ notification->setBody(options->body());
+ if (options->hasTag())
+ notification->setTag(options->tag());
+ notification->setLang(options->lang());
+ notification->setDir(options->dir());
+ if (options->hasIcon()) {
+ KURL iconUrl = options->icon().isEmpty() ? KURL() : context->completeURL(options->icon());
if (!iconUrl.isEmpty() && iconUrl.isValid())
notification->setIconUrl(iconUrl);
}

Powered by Google App Engine
This is Rietveld 408576698