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

Side by Side Diff: components/gcm_driver/gcm_app_handler.h

Issue 2473813002: Notify GCMAppHandlers when the store is reset, so they clear cached IDs (Closed)
Patch Set: Created 4 years, 1 month 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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_ 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_ 6 #define COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "components/gcm_driver/gcm_client.h" 10 #include "components/gcm_driver/gcm_client.h"
11 11
12 namespace gcm { 12 namespace gcm {
13 13
14 // Defines the interface to provide handling and event routing logic for a given 14 // Defines the interface to provide handling and event routing logic for a given
15 // app. 15 // app.
16 class GCMAppHandler { 16 class GCMAppHandler {
17 public: 17 public:
18 GCMAppHandler(); 18 GCMAppHandler();
19 virtual ~GCMAppHandler(); 19 virtual ~GCMAppHandler();
20 20
21 // Called to do all the cleanup when GCM is shutting down. 21 // Called to do all the cleanup when GCM is shutting down.
22 // In the case that multiple apps share the same app handler, it should be 22 // In the case that multiple apps share the same app handler, it should be
23 // make safe for ShutdownHandler to be called multiple times. 23 // make safe for ShutdownHandler to be called multiple times.
24 virtual void ShutdownHandler() = 0; 24 virtual void ShutdownHandler() = 0;
25 25
26 // Called when the GCM store is reset (e.g. due to corruption), which changes
27 // the device ID, invalidating all prior registrations. Any stored
28 // registration IDs should be deleted.
Peter Beverloo 2016/11/03 17:28:57 Maybe broaden this to "Any stored state related to
johnme 2016/11/08 19:22:41 Done (also mentioned InstanceIDs).
29 virtual void OnStoreReset() = 0;
30
26 // Called when a GCM message has been received. 31 // Called when a GCM message has been received.
27 virtual void OnMessage(const std::string& app_id, 32 virtual void OnMessage(const std::string& app_id,
28 const IncomingMessage& message) = 0; 33 const IncomingMessage& message) = 0;
29 34
30 // Called when some GCM messages have been deleted from the server. 35 // Called when some GCM messages have been deleted from the server.
31 virtual void OnMessagesDeleted(const std::string& app_id) = 0; 36 virtual void OnMessagesDeleted(const std::string& app_id) = 0;
32 37
33 // Called when a GCM message failed to be delivered. 38 // Called when a GCM message failed to be delivered.
34 virtual void OnSendError( 39 virtual void OnSendError(
35 const std::string& app_id, 40 const std::string& app_id,
36 const GCMClient::SendErrorDetails& send_error_details) = 0; 41 const GCMClient::SendErrorDetails& send_error_details) = 0;
37 42
38 // Called when a GCM message was received by GCM server. 43 // Called when a GCM message was received by GCM server.
39 virtual void OnSendAcknowledged(const std::string& app_id, 44 virtual void OnSendAcknowledged(const std::string& app_id,
40 const std::string& message_id) = 0; 45 const std::string& message_id) = 0;
41 46
42 // If no app handler has been added with the exact app_id of an incoming 47 // If no app handler has been added with the exact app_id of an incoming
43 // event, all handlers will be asked (in arbitrary order) whether they can 48 // event, all handlers will be asked (in arbitrary order) whether they can
44 // handle the app_id, and the first to return true will receive the event. 49 // handle the app_id, and the first to return true will receive the event.
45 virtual bool CanHandle(const std::string& app_id) const; 50 virtual bool CanHandle(const std::string& app_id) const;
46 }; 51 };
47 52
48 } // namespace gcm 53 } // namespace gcm
49 54
50 #endif // COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_ 55 #endif // COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698