| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |