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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/NotificationData.cpp

Issue 1620203004: Notification action icons prototype. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it work on Android and clean up. Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/notifications/NotificationData.h" 5 #include "modules/notifications/NotificationData.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/SerializedScriptValue.h" 8 #include "bindings/core/v8/SerializedScriptValue.h"
9 #include "bindings/core/v8/SerializedScriptValueFactory.h" 9 #include "bindings/core/v8/SerializedScriptValueFactory.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 const size_t maxActions = Notification::maxActions(); 75 const size_t maxActions = Notification::maxActions();
76 for (const NotificationAction& action : options.actions()) { 76 for (const NotificationAction& action : options.actions()) {
77 if (actions.size() >= maxActions) 77 if (actions.size() >= maxActions)
78 break; 78 break;
79 79
80 WebNotificationAction webAction; 80 WebNotificationAction webAction;
81 webAction.action = action.action(); 81 webAction.action = action.action();
82 webAction.title = action.title(); 82 webAction.title = action.title();
83 83
84 // TODO(mvanouwerkerk): Apply the appropriate CORS checks.
85 KURL iconUrl;
86 if (action.hasIcon() && !action.icon().isEmpty()) {
87 iconUrl = executionContext->completeURL(action.icon());
88 if (!iconUrl.isValid())
89 iconUrl = KURL();
90 }
91 webAction.icon = iconUrl;
92
84 actions.append(webAction); 93 actions.append(webAction);
85 } 94 }
86 95
87 webData.actions = actions; 96 webData.actions = actions;
88 97
89 return webData; 98 return webData;
90 } 99 }
91 100
92 } // namespace blink 101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698