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

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

Issue 324913004: Skeleton GCMAppHandler for Push API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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>
(...skipping 16 matching lines...) Expand all
27 GCMClient::Result result)> RegisterCallback; 27 GCMClient::Result result)> RegisterCallback;
28 typedef base::Callback<void(const std::string& message_id, 28 typedef base::Callback<void(const std::string& message_id,
29 GCMClient::Result result)> SendCallback; 29 GCMClient::Result result)> SendCallback;
30 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback; 30 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback;
31 typedef base::Callback<void(const GCMClient::GCMStatistics& stats)> 31 typedef base::Callback<void(const GCMClient::GCMStatistics& stats)>
32 GetGCMStatisticsCallback; 32 GetGCMStatisticsCallback;
33 33
34 GCMDriver(); 34 GCMDriver();
35 virtual ~GCMDriver(); 35 virtual ~GCMDriver();
36 36
37 void SetLazyLoadAppHandlersClosure(
38 const base::Closure& lazy_load_app_handlers);
39
37 // Registers |sender_id| for an app. A registration ID will be returned by 40 // Registers |sender_id| for an app. A registration ID will be returned by
38 // the GCM server. 41 // the GCM server.
39 // |app_id|: application ID. 42 // |app_id|: application ID.
40 // |sender_ids|: list of IDs of the servers that are allowed to send the 43 // |sender_ids|: list of IDs of the servers that are allowed to send the
41 // messages to the application. These IDs are assigned by the 44 // messages to the application. These IDs are assigned by the
42 // Google API Console. 45 // Google API Console.
43 // |callback|: to be called once the asynchronous operation is done. 46 // |callback|: to be called once the asynchronous operation is done.
44 void Register(const std::string& app_id, 47 void Register(const std::string& app_id,
45 const std::vector<std::string>& sender_ids, 48 const std::vector<std::string>& sender_ids,
46 const RegisterCallback& callback); 49 const RegisterCallback& callback);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Callback map (from <app_id, message_id> to callback) for Send. 153 // Callback map (from <app_id, message_id> to callback) for Send.
151 std::map<std::pair<std::string, std::string>, SendCallback> send_callbacks_; 154 std::map<std::pair<std::string, std::string>, SendCallback> send_callbacks_;
152 155
153 // App handler map (from app_id to handler pointer). 156 // App handler map (from app_id to handler pointer).
154 // The handler is not owned. 157 // The handler is not owned.
155 GCMAppHandlerMap app_handlers_; 158 GCMAppHandlerMap app_handlers_;
156 159
157 // The default handler when no app handler can be found in the map. 160 // The default handler when no app handler can be found in the map.
158 DefaultGCMAppHandler default_app_handler_; 161 DefaultGCMAppHandler default_app_handler_;
159 162
163 // Called before the first time GetAppHandler is run, to allow consumers
164 // to register app handlers on demand.
fgorski 2014/06/10 17:09:28 Please explain that scenario a bit better in respo
johnme 2014/06/10 20:33:48 Replied out of band by email.
165 base::Closure lazy_load_app_handlers_;
166
160 DISALLOW_COPY_AND_ASSIGN(GCMDriver); 167 DISALLOW_COPY_AND_ASSIGN(GCMDriver);
161 }; 168 };
162 169
163 } // namespace gcm 170 } // namespace gcm
164 171
165 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ 172 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698