OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "modules/notifications/ServiceWorkerRegistrationNotifications.h" | 6 #include "modules/notifications/ServiceWorkerRegistrationNotifications.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // FIXME: Do the appropriate CORS checks on the icon URL. | 39 // FIXME: Do the appropriate CORS checks on the icon URL. |
40 | 40 |
41 KURL iconUrl; | 41 KURL iconUrl; |
42 if (options.hasIcon() && !options.icon().isEmpty()) { | 42 if (options.hasIcon() && !options.icon().isEmpty()) { |
43 iconUrl = executionContext->completeURL(options.icon()); | 43 iconUrl = executionContext->completeURL(options.icon()); |
44 if (!iconUrl.isValid()) | 44 if (!iconUrl.isValid()) |
45 iconUrl = KURL(); | 45 iconUrl = KURL(); |
46 } | 46 } |
47 | 47 |
48 WebNotificationData::Direction dir = options.dir() == "rtl" ? WebNotificatio
nData::DirectionRightToLeft : WebNotificationData::DirectionLeftToRight; | 48 WebNotificationData::Direction dir = options.dir() == "rtl" ? WebNotificatio
nData::DirectionRightToLeft : WebNotificationData::DirectionLeftToRight; |
49 WebNotificationData notification(title, dir, options.lang(), options.body(),
options.tag(), iconUrl); | 49 WebNotificationData notification(title, dir, options.lang(), options.body(),
options.tag(), iconUrl, options.silent()); |
50 WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, v
oid>(resolver); | 50 WebNotificationShowCallbacks* callbacks = new CallbackPromiseAdapter<void, v
oid>(resolver); |
51 | 51 |
52 SecurityOrigin* origin = executionContext->securityOrigin(); | 52 SecurityOrigin* origin = executionContext->securityOrigin(); |
53 ASSERT(origin); | 53 ASSERT(origin); |
54 | 54 |
55 WebNotificationManager* notificationManager = Platform::current()->notificat
ionManager(); | 55 WebNotificationManager* notificationManager = Platform::current()->notificat
ionManager(); |
56 ASSERT(notificationManager); | 56 ASSERT(notificationManager); |
57 | 57 |
58 notificationManager->showPersistent(WebSerializedOrigin(*origin), notificati
on, serviceWorkerRegistration.webRegistration(), callbacks); | 58 notificationManager->showPersistent(WebSerializedOrigin(*origin), notificati
on, serviceWorkerRegistration.webRegistration(), callbacks); |
59 return promise; | 59 return promise; |
60 } | 60 } |
61 | 61 |
62 } // namespace blink | 62 } // namespace blink |
OLD | NEW |