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

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

Issue 1134733006: Push API: use (un)subscription instead of (un)registration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed pre-submit warning Created 5 years, 7 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
« no previous file with comments | « content/shell/browser/layout_test/layout_test_push_messaging_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/public/browser/permission_type.h" 9 #include "content/public/browser/permission_type.h"
10 #include "content/shell/browser/layout_test/layout_test_browser_context.h" 10 #include "content/shell/browser/layout_test/layout_test_browser_context.h"
(...skipping 24 matching lines...) Expand all
35 LayoutTestPushMessagingService::LayoutTestPushMessagingService() { 35 LayoutTestPushMessagingService::LayoutTestPushMessagingService() {
36 } 36 }
37 37
38 LayoutTestPushMessagingService::~LayoutTestPushMessagingService() { 38 LayoutTestPushMessagingService::~LayoutTestPushMessagingService() {
39 } 39 }
40 40
41 GURL LayoutTestPushMessagingService::GetPushEndpoint() { 41 GURL LayoutTestPushMessagingService::GetPushEndpoint() {
42 return GURL("https://example.com/LayoutTestEndpoint"); 42 return GURL("https://example.com/LayoutTestEndpoint");
43 } 43 }
44 44
45 void LayoutTestPushMessagingService::RegisterFromDocument( 45 void LayoutTestPushMessagingService::SubscribeFromDocument(
46 const GURL& requesting_origin, 46 const GURL& requesting_origin,
47 int64 service_worker_registration_id, 47 int64 service_worker_registration_id,
48 const std::string& sender_id, 48 const std::string& sender_id,
49 int renderer_id, 49 int renderer_id,
50 int render_frame_id, 50 int render_frame_id,
51 bool user_visible, 51 bool user_visible,
52 const PushMessagingService::RegisterCallback& callback) { 52 const PushMessagingService::RegisterCallback& callback) {
53 RegisterFromWorker(requesting_origin, service_worker_registration_id, 53 SubscribeFromWorker(requesting_origin, service_worker_registration_id,
54 sender_id, user_visible, callback); 54 sender_id, user_visible, callback);
55 } 55 }
56 56
57 void LayoutTestPushMessagingService::RegisterFromWorker( 57 void LayoutTestPushMessagingService::SubscribeFromWorker(
58 const GURL& requesting_origin, 58 const GURL& requesting_origin,
59 int64 service_worker_registration_id, 59 int64 service_worker_registration_id,
60 const std::string& sender_id, 60 const std::string& sender_id,
61 bool user_visible, 61 bool user_visible,
62 const PushMessagingService::RegisterCallback& callback) { 62 const PushMessagingService::RegisterCallback& callback) {
63 if (GetPermissionStatus(requesting_origin, requesting_origin, user_visible) == 63 if (GetPermissionStatus(requesting_origin, requesting_origin, user_visible) ==
64 blink::WebPushPermissionStatusGranted) { 64 blink::WebPushPermissionStatusGranted) {
65 callback.Run("layoutTestRegistrationId", 65 callback.Run("layoutTestRegistrationId",
66 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE); 66 PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
67 } else { 67 } else {
(...skipping 11 matching lines...) Expand all
79 ->GetLayoutTestPermissionManager() 79 ->GetLayoutTestPermissionManager()
80 ->GetPermissionStatus(PermissionType::PUSH_MESSAGING, 80 ->GetPermissionStatus(PermissionType::PUSH_MESSAGING,
81 requesting_origin, 81 requesting_origin,
82 embedding_origin)); 82 embedding_origin));
83 } 83 }
84 84
85 bool LayoutTestPushMessagingService::SupportNonVisibleMessages() { 85 bool LayoutTestPushMessagingService::SupportNonVisibleMessages() {
86 return false; 86 return false;
87 } 87 }
88 88
89 void LayoutTestPushMessagingService::Unregister( 89 void LayoutTestPushMessagingService::Unsubscribe(
90 const GURL& requesting_origin, 90 const GURL& requesting_origin,
91 int64 service_worker_registration_id, 91 int64 service_worker_registration_id,
92 const std::string& sender_id, 92 const std::string& sender_id,
93 const UnregisterCallback& callback) { 93 const UnregisterCallback& callback) {
94 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED); 94 callback.Run(PUSH_UNREGISTRATION_STATUS_SUCCESS_UNREGISTERED);
95 } 95 }
96 96
97 } // namespace content 97 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/layout_test/layout_test_push_messaging_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698