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" |
11 #include "content/shell/browser/layout_test/layout_test_browser_context.h" | 11 #include "content/shell/browser/layout_test/layout_test_browser_context.h" |
12 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h
" | 12 #include "content/shell/browser/layout_test/layout_test_content_browser_client.h
" |
13 #include "content/shell/browser/layout_test/layout_test_permission_manager.h" | 13 #include "content/shell/browser/layout_test/layout_test_permission_manager.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // P-256 public key made available to layout tests. Must be 32 bytes. | 19 // P-256 public key made available to layout tests. Must be 32 bytes. |
20 const uint8_t kTestP256Key[] = { | 20 const uint8_t kTestP256Key[] = { |
21 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, | 21 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, |
22 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, | 22 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
23 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F | 23 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F |
24 }; | 24 }; |
25 | 25 |
26 static_assert(sizeof(kTestP256Key) == 32, | 26 static_assert(sizeof(kTestP256Key) == 32, |
27 "The fake public key must have the size of a real public key."); | 27 "The fake public key must have the size of a real public key."); |
28 | 28 |
29 blink::WebPushPermissionStatus ToWebPushPermissionStatus( | 29 blink::WebPushPermissionStatus ToWebPushPermissionStatus( |
30 PermissionStatus status) { | 30 permission::Status status) { |
31 switch (status) { | 31 switch (status) { |
32 case PERMISSION_STATUS_GRANTED: | 32 case permission::STATUS_GRANTED: |
33 return blink::WebPushPermissionStatusGranted; | 33 return blink::WebPushPermissionStatusGranted; |
34 case PERMISSION_STATUS_DENIED: | 34 case permission::STATUS_DENIED: |
35 return blink::WebPushPermissionStatusDenied; | 35 return blink::WebPushPermissionStatusDenied; |
36 case PERMISSION_STATUS_ASK: | 36 case permission::STATUS_ASK: |
37 return blink::WebPushPermissionStatusPrompt; | 37 return blink::WebPushPermissionStatusPrompt; |
38 } | 38 } |
39 | 39 |
40 NOTREACHED(); | 40 NOTREACHED(); |
41 return blink::WebPushPermissionStatusLast; | 41 return blink::WebPushPermissionStatusLast; |
42 } | 42 } |
43 | 43 |
44 } // anonymous namespace | 44 } // anonymous namespace |
45 | 45 |
46 LayoutTestPushMessagingService::LayoutTestPushMessagingService() { | 46 LayoutTestPushMessagingService::LayoutTestPushMessagingService() { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 void LayoutTestPushMessagingService::Unsubscribe( | 114 void LayoutTestPushMessagingService::Unsubscribe( |
115 const GURL& requesting_origin, | 115 const GURL& requesting_origin, |
116 int64 service_worker_registration_id, | 116 int64 service_worker_registration_id, |
117 const std::string& sender_id, | 117 const std::string& sender_id, |
118 const UnregisterCallback& callback) { | 118 const UnregisterCallback& callback) { |
119 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED); | 119 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED); |
120 } | 120 } |
121 | 121 |
122 } // namespace content | 122 } // namespace content |
OLD | NEW |