Chromium Code Reviews| 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.hasAppServicePublicKey() && options.appServicePublicKey()) | |
| 42 webOptions.applicationServerKey = WTF::String(static_cast<const char*>(o ptions.appServicePublicKey()->data())); | |
|
Peter Beverloo
2016/02/17 16:15:36
This isn't safe because the |applicationServerKey|
harkness
2016/02/18 10:45:15
Done.
| |
| 41 return webOptions; | 43 return webOptions; |
| 42 } | 44 } |
| 43 | 45 |
| 44 } // namespace | 46 } // namespace |
| 45 | 47 |
| 46 PushManager::PushManager(ServiceWorkerRegistration* registration) | 48 PushManager::PushManager(ServiceWorkerRegistration* registration) |
| 47 : m_registration(registration) | 49 : m_registration(registration) |
| 48 { | 50 { |
| 49 ASSERT(registration); | 51 ASSERT(registration); |
| 50 } | 52 } |
| (...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)); | 97 pushProvider()->getPermissionStatus(m_registration->webRegistration(), toWeb PushSubscriptionOptions(options), new PushPermissionStatusCallbacks(resolver)); |
| 96 return promise; | 98 return promise; |
| 97 } | 99 } |
| 98 | 100 |
| 99 DEFINE_TRACE(PushManager) | 101 DEFINE_TRACE(PushManager) |
| 100 { | 102 { |
| 101 visitor->trace(m_registration); | 103 visitor->trace(m_registration); |
| 102 } | 104 } |
| 103 | 105 |
| 104 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |