Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/Source/modules/push_messaging/PushManager.cpp

Issue 2863443002: Implement and ship PushManager.supportedContentEncodings (Closed)
Patch Set: Implement and ship PushManager.supportedContentEncodings Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"});
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698