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 "content/shell/browser/layout_test/layout_test_push_messaging_service.h
" | 5 #include "content/shell/browser/layout_test/layout_test_push_messaging_service.h
" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "content/public/browser/permission_type.h" | 10 #include "content/public/browser/permission_type.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 kTestP256Key, kTestP256Key + arraysize(kTestP256Key)); | 112 kTestP256Key, kTestP256Key + arraysize(kTestP256Key)); |
113 std::vector<uint8_t> auth( | 113 std::vector<uint8_t> auth( |
114 kAuthentication, kAuthentication + arraysize(kAuthentication)); | 114 kAuthentication, kAuthentication + arraysize(kAuthentication)); |
115 | 115 |
116 callback.Run(true /* is_valid */, p256dh, auth); | 116 callback.Run(true /* is_valid */, p256dh, auth); |
117 } | 117 } |
118 | 118 |
119 blink::WebPushPermissionStatus | 119 blink::WebPushPermissionStatus |
120 LayoutTestPushMessagingService::GetPermissionStatus(const GURL& origin, | 120 LayoutTestPushMessagingService::GetPermissionStatus(const GURL& origin, |
121 bool user_visible) { | 121 bool user_visible) { |
122 return ToWebPushPermissionStatus(LayoutTestContentBrowserClient::Get() | 122 // This may be called for checking the permission for both a frame or a worker |
123 ->browser_context() | 123 // however, since notifications can be used equally from frames/workers it's |
124 ->GetPermissionManager() | 124 // sufficient just to check that whether it's available in the worker. |
125 ->GetPermissionStatus(PermissionType::PUSH_MESSAGING, origin, origin)); | 125 return ToWebPushPermissionStatus( |
| 126 LayoutTestContentBrowserClient::Get() |
| 127 ->browser_context() |
| 128 ->GetPermissionManager() |
| 129 ->GetPermissionStatusForWorker(PermissionType::PUSH_MESSAGING, |
| 130 origin)); |
126 } | 131 } |
127 | 132 |
128 bool LayoutTestPushMessagingService::SupportNonVisibleMessages() { | 133 bool LayoutTestPushMessagingService::SupportNonVisibleMessages() { |
129 return false; | 134 return false; |
130 } | 135 } |
131 | 136 |
132 void LayoutTestPushMessagingService::Unsubscribe( | 137 void LayoutTestPushMessagingService::Unsubscribe( |
133 PushUnregistrationReason reason, | 138 PushUnregistrationReason reason, |
134 const GURL& requesting_origin, | 139 const GURL& requesting_origin, |
135 int64_t service_worker_registration_id, | 140 int64_t service_worker_registration_id, |
(...skipping 18 matching lines...) Expand all Loading... |
154 const GURL& origin, | 159 const GURL& origin, |
155 int64_t service_worker_registration_id) { | 160 int64_t service_worker_registration_id) { |
156 if (service_worker_registration_id == | 161 if (service_worker_registration_id == |
157 subscribed_service_worker_registration_) { | 162 subscribed_service_worker_registration_) { |
158 subscribed_service_worker_registration_ = | 163 subscribed_service_worker_registration_ = |
159 kInvalidServiceWorkerRegistrationId; | 164 kInvalidServiceWorkerRegistrationId; |
160 } | 165 } |
161 } | 166 } |
162 | 167 |
163 } // namespace content | 168 } // namespace content |
OLD | NEW |