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 "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 return web_push_provider; | 35 return web_push_provider; |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 PushManager::PushManager(ServiceWorkerRegistration* registration) | 40 PushManager::PushManager(ServiceWorkerRegistration* registration) |
41 : registration_(registration) { | 41 : registration_(registration) { |
42 DCHECK(registration); | 42 DCHECK(registration); |
43 } | 43 } |
44 | 44 |
45 // static | |
46 Vector<String> PushManager::supportedContentEncodings() { | |
47 return Vector<String>({"aesgcm"}); | |
johnme
2017/05/08 14:36:16
Nit: should this be an AtomicString?
Peter Beverloo
2017/05/08 15:00:11
That seems a bit excessive. This method is only be
johnme
2017/05/08 15:09:27
Acknowledged.
| |
48 } | |
49 | |
45 ScriptPromise PushManager::subscribe(ScriptState* script_state, | 50 ScriptPromise PushManager::subscribe(ScriptState* script_state, |
46 const PushSubscriptionOptionsInit& options, | 51 const PushSubscriptionOptionsInit& options, |
47 ExceptionState& exception_state) { | 52 ExceptionState& exception_state) { |
48 if (!registration_->active()) | 53 if (!registration_->active()) |
49 return ScriptPromise::RejectWithDOMException( | 54 return ScriptPromise::RejectWithDOMException( |
50 script_state, | 55 script_state, |
51 DOMException::Create(kAbortError, | 56 DOMException::Create(kAbortError, |
52 "Subscription failed - no active Service Worker")); | 57 "Subscription failed - no active Service Worker")); |
53 | 58 |
54 const WebPushSubscriptionOptions& web_options = | 59 const WebPushSubscriptionOptions& web_options = |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 PushSubscriptionOptions::ToWeb(options, exception_state), | 118 PushSubscriptionOptions::ToWeb(options, exception_state), |
114 WTF::MakeUnique<PushPermissionStatusCallbacks>(resolver)); | 119 WTF::MakeUnique<PushPermissionStatusCallbacks>(resolver)); |
115 return promise; | 120 return promise; |
116 } | 121 } |
117 | 122 |
118 DEFINE_TRACE(PushManager) { | 123 DEFINE_TRACE(PushManager) { |
119 visitor->Trace(registration_); | 124 visitor->Trace(registration_); |
120 } | 125 } |
121 | 126 |
122 } // namespace blink | 127 } // namespace blink |
OLD | NEW |