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

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

Issue 445683003: [GCM] Exposing persistence of account mappings in GCM Driver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates based on self review Created 6 years, 4 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 | Annotate | Revision Log
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 COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "components/gcm_driver/default_gcm_app_handler.h" 15 #include "components/gcm_driver/default_gcm_app_handler.h"
16 #include "components/gcm_driver/gcm_client.h" 16 #include "components/gcm_driver/gcm_client.h"
17 17
18 namespace gcm { 18 namespace gcm {
19 19
20 class GCMAppHandler; 20 class GCMAppHandler;
21 struct AccountMapping;
21 22
22 // Bridge between GCM users in Chrome and the platform-specific implementation. 23 // Bridge between GCM users in Chrome and the platform-specific implementation.
23 class GCMDriver { 24 class GCMDriver {
24 public: 25 public:
25 typedef std::map<std::string, GCMAppHandler*> GCMAppHandlerMap; 26 typedef std::map<std::string, GCMAppHandler*> GCMAppHandlerMap;
26 typedef base::Callback<void(const std::string& registration_id, 27 typedef base::Callback<void(const std::string& registration_id,
27 GCMClient::Result result)> RegisterCallback; 28 GCMClient::Result result)> RegisterCallback;
28 typedef base::Callback<void(const std::string& message_id, 29 typedef base::Callback<void(const std::string& message_id,
29 GCMClient::Result result)> SendCallback; 30 GCMClient::Result result)> SendCallback;
30 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback; 31 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // Get GCM client internal states and statistics. 104 // Get GCM client internal states and statistics.
104 // If clear_logs is true then activity logs will be cleared before the stats 105 // If clear_logs is true then activity logs will be cleared before the stats
105 // are returned. 106 // are returned.
106 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback, 107 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback,
107 bool clear_logs) = 0; 108 bool clear_logs) = 0;
108 109
109 // Enables/disables GCM activity recording, and then returns the stats. 110 // Enables/disables GCM activity recording, and then returns the stats.
110 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback, 111 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback,
111 bool recording) = 0; 112 bool recording) = 0;
112 113
114 // Updates the |account_mapping| information in persistent store.
115 virtual void UpdateAccountMapping(const AccountMapping& account_mapping) = 0;
116
117 // Removes the account mapping information reated to |account_id| from
118 // persistent store.
119 virtual void RemoveAccountMapping(const std::string& account_id) = 0;
120
113 protected: 121 protected:
114 // Ensures that the GCM service starts (if necessary conditions are met). 122 // Ensures that the GCM service starts (if necessary conditions are met).
115 virtual GCMClient::Result EnsureStarted() = 0; 123 virtual GCMClient::Result EnsureStarted() = 0;
116 124
117 // Platform-specific implementation of Register. 125 // Platform-specific implementation of Register.
118 virtual void RegisterImpl(const std::string& app_id, 126 virtual void RegisterImpl(const std::string& app_id,
119 const std::vector<std::string>& sender_ids) = 0; 127 const std::vector<std::string>& sender_ids) = 0;
120 128
121 // Platform-specific implementation of Unregister. 129 // Platform-specific implementation of Unregister.
122 virtual void UnregisterImpl(const std::string& app_id) = 0; 130 virtual void UnregisterImpl(const std::string& app_id) = 0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 172
165 // The default handler when no app handler can be found in the map. 173 // The default handler when no app handler can be found in the map.
166 DefaultGCMAppHandler default_app_handler_; 174 DefaultGCMAppHandler default_app_handler_;
167 175
168 DISALLOW_COPY_AND_ASSIGN(GCMDriver); 176 DISALLOW_COPY_AND_ASSIGN(GCMDriver);
169 }; 177 };
170 178
171 } // namespace gcm 179 } // namespace gcm
172 180
173 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ 181 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698