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

Side by Side Diff: chrome/browser/services/gcm/push_messaging_service_impl.h

Issue 793403002: Implement WebPushProvider.unregister() in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mvan_2
Patch Set: jochen review comments Created 6 years 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 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "components/gcm_driver/gcm_app_handler.h" 10 #include "components/gcm_driver/gcm_app_handler.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const std::string& sender_id, 57 const std::string& sender_id,
58 int renderer_id, 58 int renderer_id,
59 int render_frame_id, 59 int render_frame_id,
60 bool user_visible_only, 60 bool user_visible_only,
61 const content::PushMessagingService::RegisterCallback& callback) override; 61 const content::PushMessagingService::RegisterCallback& callback) override;
62 void RegisterFromWorker( 62 void RegisterFromWorker(
63 const GURL& requesting_origin, 63 const GURL& requesting_origin,
64 int64 service_worker_registration_id, 64 int64 service_worker_registration_id,
65 const std::string& sender_id, 65 const std::string& sender_id,
66 const content::PushMessagingService::RegisterCallback& callback) override; 66 const content::PushMessagingService::RegisterCallback& callback) override;
67 void Unregister(
68 const GURL& requesting_origin,
69 int64 service_worker_registration_id,
70 const content::PushMessagingService::UnregisterCallback&) override;
67 // TODO(mvanouwerkerk): Delete once the Push API flows through platform. 71 // TODO(mvanouwerkerk): Delete once the Push API flows through platform.
68 // https://crbug.com/389194 72 // https://crbug.com/389194
69 blink::WebPushPermissionStatus GetPermissionStatus( 73 blink::WebPushPermissionStatus GetPermissionStatus(
70 const GURL& requesting_origin, 74 const GURL& requesting_origin,
71 int renderer_id, 75 int renderer_id,
72 int render_frame_id) override; 76 int render_frame_id) override;
73 blink::WebPushPermissionStatus GetPermissionStatus( 77 blink::WebPushPermissionStatus GetPermissionStatus(
74 const GURL& requesting_origin, 78 const GURL& requesting_origin,
75 const GURL& embedding_origin) override; 79 const GURL& embedding_origin) override;
76 80
(...skipping 16 matching lines...) Expand all
93 const content::PushMessagingService::RegisterCallback& callback, 97 const content::PushMessagingService::RegisterCallback& callback,
94 const std::string& registration_id, 98 const std::string& registration_id,
95 GCMClient::Result result); 99 GCMClient::Result result);
96 100
97 void DidRequestPermission( 101 void DidRequestPermission(
98 const PushMessagingApplicationId& application_id, 102 const PushMessagingApplicationId& application_id,
99 const std::string& sender_id, 103 const std::string& sender_id,
100 const content::PushMessagingService::RegisterCallback& callback, 104 const content::PushMessagingService::RegisterCallback& callback,
101 bool allow); 105 bool allow);
102 106
103 // TODO(mvanouwerkerk): this will need to be extended and move to the 107 void Unregister(const PushMessagingApplicationId& application_id,
104 // PushMessagingService interface later. 108 const content::PushMessagingService::UnregisterCallback&);
105 void Unregister(const PushMessagingApplicationId& application_id);
106 109
107 void DidUnregister(GCMClient::Result result); 110 void DidUnregister(const content::PushMessagingService::UnregisterCallback&,
111 GCMClient::Result result);
108 112
109 // Helper method that checks if a given origin is allowed to use Push. 113 // Helper method that checks if a given origin is allowed to use Push.
110 bool HasPermission(const GURL& origin); 114 bool HasPermission(const GURL& origin);
111 115
112 // Adds this service as an app handler to the GCMDriver if it has not been 116 // Adds this service as an app handler to the GCMDriver if it has not been
113 // added yet. 117 // added yet.
114 void AddAppHandlerIfNecessary(); 118 void AddAppHandlerIfNecessary();
115 119
116 GCMProfileService* gcm_profile_service_; // It owns us. 120 GCMProfileService* gcm_profile_service_; // It owns us.
117 121
118 Profile* profile_; // It owns our owner. 122 Profile* profile_; // It owns our owner.
119 123
120 int push_registration_count_; 124 int push_registration_count_;
121 125
122 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_; 126 base::WeakPtrFactory<PushMessagingServiceImpl> weak_factory_;
123 127
124 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl); 128 DISALLOW_COPY_AND_ASSIGN(PushMessagingServiceImpl);
125 }; 129 };
126 130
127 } // namespace gcm 131 } // namespace gcm
128 132
129 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_ 133 #endif // CHROME_BROWSER_SERVICES_GCM_PUSH_MESSAGING_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/push_messaging_browsertest.cc ('k') | chrome/browser/services/gcm/push_messaging_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698