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

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

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Adding new file I missed previously. Created 3 years, 11 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
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // works in context of a signed in entity (e.g. browser profile where user is 192 // works in context of a signed in entity (e.g. browser profile where user is
193 // signed into sync). 193 // signed into sync).
194 // |account_tokens|: list of email addresses, account IDs and OAuth2 access 194 // |account_tokens|: list of email addresses, account IDs and OAuth2 access
195 // tokens. 195 // tokens.
196 virtual void SetAccountTokens( 196 virtual void SetAccountTokens(
197 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) = 0; 197 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) = 0;
198 198
199 // Updates the |account_mapping| information in persistent store. 199 // Updates the |account_mapping| information in persistent store.
200 virtual void UpdateAccountMapping(const AccountMapping& account_mapping) = 0; 200 virtual void UpdateAccountMapping(const AccountMapping& account_mapping) = 0;
201 201
202 // Removes the account mapping information reated to |account_id| from 202 // Removes the account mapping information related to |account_id| from
203 // persistent store. 203 // persistent store.
204 virtual void RemoveAccountMapping(const std::string& account_id) = 0; 204 virtual void RemoveAccountMapping(const std::string& account_id) = 0;
205 205
206 // Getter and setter of last token fetch time. 206 // Getter and setter of last token fetch time.
207 virtual base::Time GetLastTokenFetchTime() = 0; 207 virtual base::Time GetLastTokenFetchTime() = 0;
208 virtual void SetLastTokenFetchTime(const base::Time& time) = 0; 208 virtual void SetLastTokenFetchTime(const base::Time& time) = 0;
209 209
210 // Sets whether or not GCM should try to wake the system from suspend in order 210 // Sets whether or not GCM should try to wake the system from suspend in order
211 // to send a heartbeat message. 211 // to send a heartbeat message.
212 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0; 212 virtual void WakeFromSuspendForHeartbeat(bool wake) = 0;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 bool HasRegisterCallback(const std::string& app_id); 286 bool HasRegisterCallback(const std::string& app_id);
287 287
288 void ClearCallbacks(); 288 void ClearCallbacks();
289 289
290 // Dispatches the OnMessage event to the app handler associated with |app_id|. 290 // Dispatches the OnMessage event to the app handler associated with |app_id|.
291 // If |message| has been encrypted, it will be decrypted asynchronously and 291 // If |message| has been encrypted, it will be decrypted asynchronously and
292 // dispatched when the decryption operation was successful. Otherwise, the 292 // dispatched when the decryption operation was successful. Otherwise, the
293 // |message| will be dispatched immediately to the handler for |app_id|. 293 // |message| will be dispatched immediately to the handler for |app_id|.
294 void DispatchMessage(const std::string& app_id, 294 void DispatchMessage(const std::string& app_id,
295 const IncomingMessage& message); 295 const IncomingMessage& message,
296 const GCMClient::MessageReceiptCallback& callback);
296 297
297 private: 298 private:
298 // Common code shared by Unregister and UnregisterWithSenderId. 299 // Common code shared by Unregister and UnregisterWithSenderId.
299 void UnregisterInternal(const std::string& app_id, 300 void UnregisterInternal(const std::string& app_id,
300 const std::string* sender_id, 301 const std::string* sender_id,
301 const UnregisterCallback& callback); 302 const UnregisterCallback& callback);
302 303
303 // Dispatches the OnMessage event to the app handler associated with |app_id| 304 // Dispatches the OnMessage event to the app handler associated with |app_id|
304 // if |result| indicates that it is safe to do so, or will report a decryption 305 // if |result| indicates that it is safe to do so, or will report a decryption
305 // failure for the |app_id| otherwise. 306 // failure for the |app_id| otherwise.
306 void DispatchMessageInternal(const std::string& app_id, 307 void DispatchMessageInternal(
307 GCMEncryptionProvider::DecryptionResult result, 308 const std::string& app_id,
308 const IncomingMessage& message); 309 const GCMClient::MessageReceiptCallback& callback,
310 GCMEncryptionProvider::DecryptionResult result,
311 const IncomingMessage& message);
309 312
310 // Called after unregistration completes in order to trigger the pending 313 // Called after unregistration completes in order to trigger the pending
311 // registration. 314 // registration.
312 void RegisterAfterUnregister( 315 void RegisterAfterUnregister(
313 const std::string& app_id, 316 const std::string& app_id,
314 const std::vector<std::string>& normalized_sender_ids, 317 const std::vector<std::string>& normalized_sender_ids,
315 const UnregisterCallback& unregister_callback, 318 const UnregisterCallback& unregister_callback,
316 GCMClient::Result result); 319 GCMClient::Result result);
317 320
318 // Callback map (from app_id to callback) for Register. 321 // Callback map (from app_id to callback) for Register.
(...skipping 17 matching lines...) Expand all
336 DefaultGCMAppHandler default_app_handler_; 339 DefaultGCMAppHandler default_app_handler_;
337 340
338 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; 341 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_;
339 342
340 DISALLOW_COPY_AND_ASSIGN(GCMDriver); 343 DISALLOW_COPY_AND_ASSIGN(GCMDriver);
341 }; 344 };
342 345
343 } // namespace gcm 346 } // namespace gcm
344 347
345 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ 348 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698