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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 LayoutTestPushMessagingService::~LayoutTestPushMessagingService() { | 60 LayoutTestPushMessagingService::~LayoutTestPushMessagingService() { |
61 } | 61 } |
62 | 62 |
63 GURL LayoutTestPushMessagingService::GetPushEndpoint() { | 63 GURL LayoutTestPushMessagingService::GetPushEndpoint() { |
64 return GURL("https://example.com/LayoutTestEndpoint"); | 64 return GURL("https://example.com/LayoutTestEndpoint"); |
65 } | 65 } |
66 | 66 |
67 void LayoutTestPushMessagingService::SubscribeFromDocument( | 67 void LayoutTestPushMessagingService::SubscribeFromDocument( |
68 const GURL& requesting_origin, | 68 const GURL& requesting_origin, |
69 int64 service_worker_registration_id, | 69 int64_t service_worker_registration_id, |
70 const std::string& sender_id, | 70 const std::string& sender_id, |
71 int renderer_id, | 71 int renderer_id, |
72 int render_frame_id, | 72 int render_frame_id, |
73 bool user_visible, | 73 bool user_visible, |
74 const PushMessagingService::RegisterCallback& callback) { | 74 const PushMessagingService::RegisterCallback& callback) { |
75 SubscribeFromWorker(requesting_origin, service_worker_registration_id, | 75 SubscribeFromWorker(requesting_origin, service_worker_registration_id, |
76 sender_id, user_visible, callback); | 76 sender_id, user_visible, callback); |
77 } | 77 } |
78 | 78 |
79 void LayoutTestPushMessagingService::SubscribeFromWorker( | 79 void LayoutTestPushMessagingService::SubscribeFromWorker( |
80 const GURL& requesting_origin, | 80 const GURL& requesting_origin, |
81 int64 service_worker_registration_id, | 81 int64_t service_worker_registration_id, |
82 const std::string& sender_id, | 82 const std::string& sender_id, |
83 bool user_visible, | 83 bool user_visible, |
84 const PushMessagingService::RegisterCallback& callback) { | 84 const PushMessagingService::RegisterCallback& callback) { |
85 if (GetPermissionStatus(requesting_origin, requesting_origin, user_visible) == | 85 if (GetPermissionStatus(requesting_origin, requesting_origin, user_visible) == |
86 blink::WebPushPermissionStatusGranted) { | 86 blink::WebPushPermissionStatusGranted) { |
87 std::vector<uint8_t> p256dh( | 87 std::vector<uint8_t> p256dh( |
88 kTestP256Key, kTestP256Key + arraysize(kTestP256Key)); | 88 kTestP256Key, kTestP256Key + arraysize(kTestP256Key)); |
89 std::vector<uint8_t> auth( | 89 std::vector<uint8_t> auth( |
90 kAuthentication, kAuthentication + arraysize(kAuthentication)); | 90 kAuthentication, kAuthentication + arraysize(kAuthentication)); |
91 | 91 |
(...skipping 30 matching lines...) Expand all Loading... |
122 requesting_origin, | 122 requesting_origin, |
123 embedding_origin)); | 123 embedding_origin)); |
124 } | 124 } |
125 | 125 |
126 bool LayoutTestPushMessagingService::SupportNonVisibleMessages() { | 126 bool LayoutTestPushMessagingService::SupportNonVisibleMessages() { |
127 return false; | 127 return false; |
128 } | 128 } |
129 | 129 |
130 void LayoutTestPushMessagingService::Unsubscribe( | 130 void LayoutTestPushMessagingService::Unsubscribe( |
131 const GURL& requesting_origin, | 131 const GURL& requesting_origin, |
132 int64 service_worker_registration_id, | 132 int64_t service_worker_registration_id, |
133 const std::string& sender_id, | 133 const std::string& sender_id, |
134 const UnregisterCallback& callback) { | 134 const UnregisterCallback& callback) { |
135 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED); | 135 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED); |
136 } | 136 } |
137 | 137 |
138 } // namespace content | 138 } // namespace content |
OLD | NEW |