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

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

Issue 1701313002: Partial implementation of subscription restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed broken file Created 4 years, 10 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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698