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

Side by Side Diff: content/shell/browser/layout_test/layout_test_push_messaging_service.cc

Issue 1770763003: Revert of Partial implementation of subscription restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 "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/public/common/push_subscription_options.h"
12 #include "content/shell/browser/layout_test/layout_test_browser_context.h" 11 #include "content/shell/browser/layout_test/layout_test_browser_context.h"
13 #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 "
14 #include "content/shell/browser/layout_test/layout_test_permission_manager.h" 13 #include "content/shell/browser/layout_test/layout_test_permission_manager.h"
15 14
16 namespace content { 15 namespace content {
17 16
18 namespace { 17 namespace {
19 18
20 // NIST P-256 public key made available to layout tests. Must be an uncompressed 19 // NIST P-256 public key made available to layout tests. Must be an uncompressed
21 // point in accordance with SEC1 2.3.3. 20 // point in accordance with SEC1 2.3.3.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 LayoutTestPushMessagingService::~LayoutTestPushMessagingService() { 60 LayoutTestPushMessagingService::~LayoutTestPushMessagingService() {
62 } 61 }
63 62
64 GURL LayoutTestPushMessagingService::GetPushEndpoint() { 63 GURL LayoutTestPushMessagingService::GetPushEndpoint() {
65 return GURL("https://example.com/LayoutTestEndpoint"); 64 return GURL("https://example.com/LayoutTestEndpoint");
66 } 65 }
67 66
68 void LayoutTestPushMessagingService::SubscribeFromDocument( 67 void LayoutTestPushMessagingService::SubscribeFromDocument(
69 const GURL& requesting_origin, 68 const GURL& requesting_origin,
70 int64_t service_worker_registration_id, 69 int64_t service_worker_registration_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 const PushSubscriptionOptions& options, 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 options, 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_t service_worker_registration_id, 81 int64_t service_worker_registration_id,
82 const PushSubscriptionOptions& options, 82 const std::string& sender_id,
83 bool user_visible,
83 const PushMessagingService::RegisterCallback& callback) { 84 const PushMessagingService::RegisterCallback& callback) {
84 if (GetPermissionStatus(requesting_origin, options.user_visible_only) == 85 if (GetPermissionStatus(requesting_origin, user_visible) ==
85 blink::WebPushPermissionStatusGranted) { 86 blink::WebPushPermissionStatusGranted) {
86 std::vector<uint8_t> p256dh( 87 std::vector<uint8_t> p256dh(
87 kTestP256Key, kTestP256Key + arraysize(kTestP256Key)); 88 kTestP256Key, kTestP256Key + arraysize(kTestP256Key));
88 std::vector<uint8_t> auth( 89 std::vector<uint8_t> auth(
89 kAuthentication, kAuthentication + arraysize(kAuthentication)); 90 kAuthentication, kAuthentication + arraysize(kAuthentication));
90 91
91 callback.Run("layoutTestRegistrationId", p256dh, auth, 92 callback.Run("layoutTestRegistrationId", p256dh, auth,
92 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE); 93 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
93 } else { 94 } else {
94 callback.Run("registration_id", std::vector<uint8_t>() /* p256dh */, 95 callback.Run("registration_id", std::vector<uint8_t>() /* p256dh */,
(...skipping 29 matching lines...) Expand all
124 125
125 void LayoutTestPushMessagingService::Unsubscribe( 126 void LayoutTestPushMessagingService::Unsubscribe(
126 const GURL& requesting_origin, 127 const GURL& requesting_origin,
127 int64_t service_worker_registration_id, 128 int64_t service_worker_registration_id,
128 const std::string& sender_id, 129 const std::string& sender_id,
129 const UnregisterCallback& callback) { 130 const UnregisterCallback& callback) {
130 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED); 131 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED);
131 } 132 }
132 133
133 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/layout_test/layout_test_push_messaging_service.h ('k') | third_party/WebKit/Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698