| 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 "modules/push_messaging/PushManager.h" | 5 #include "modules/push_messaging/PushManager.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 { | 31 { |
| 32 WebPushProvider* webPushProvider = Platform::current()->pushProvider(); | 32 WebPushProvider* webPushProvider = Platform::current()->pushProvider(); |
| 33 ASSERT(webPushProvider); | 33 ASSERT(webPushProvider); |
| 34 return webPushProvider; | 34 return webPushProvider; |
| 35 } | 35 } |
| 36 | 36 |
| 37 WebPushSubscriptionOptions toWebPushSubscriptionOptions(const PushSubscriptionOp
tions& options) | 37 WebPushSubscriptionOptions toWebPushSubscriptionOptions(const PushSubscriptionOp
tions& options) |
| 38 { | 38 { |
| 39 WebPushSubscriptionOptions webOptions; | 39 WebPushSubscriptionOptions webOptions; |
| 40 webOptions.userVisibleOnly = options.userVisibleOnly(); | 40 webOptions.userVisibleOnly = options.userVisibleOnly(); |
| 41 if (options.hasApplicationServerKey() && options.applicationServerKey()) { |
| 42 webOptions.applicationServerKey = WebString::fromUTF8( |
| 43 static_cast<const char*>(options.applicationServerKey()->data()), |
| 44 options.applicationServerKey()->byteLength()); |
| 45 } |
| 41 return webOptions; | 46 return webOptions; |
| 42 } | 47 } |
| 43 | 48 |
| 44 } // namespace | 49 } // namespace |
| 45 | 50 |
| 46 PushManager::PushManager(ServiceWorkerRegistration* registration) | 51 PushManager::PushManager(ServiceWorkerRegistration* registration) |
| 47 : m_registration(registration) | 52 : m_registration(registration) |
| 48 { | 53 { |
| 49 ASSERT(registration); | 54 ASSERT(registration); |
| 50 } | 55 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 pushProvider()->getPermissionStatus(m_registration->webRegistration(), toWeb
PushSubscriptionOptions(options), new PushPermissionStatusCallbacks(resolver)); | 100 pushProvider()->getPermissionStatus(m_registration->webRegistration(), toWeb
PushSubscriptionOptions(options), new PushPermissionStatusCallbacks(resolver)); |
| 96 return promise; | 101 return promise; |
| 97 } | 102 } |
| 98 | 103 |
| 99 DEFINE_TRACE(PushManager) | 104 DEFINE_TRACE(PushManager) |
| 100 { | 105 { |
| 101 visitor->trace(m_registration); | 106 visitor->trace(m_registration); |
| 102 } | 107 } |
| 103 | 108 |
| 104 } // namespace blink | 109 } // namespace blink |
| OLD | NEW |