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

Unified Diff: components/gcm_driver/gcm_client_impl.h

Issue 378643002: [GCM] Check-in with signed in accounts associates device to user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to the code to prevent test crashes. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/gcm_driver/gcm_client.h ('k') | components/gcm_driver/gcm_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/gcm_client_impl.h
diff --git a/components/gcm_driver/gcm_client_impl.h b/components/gcm_driver/gcm_client_impl.h
index 0ce19d6d6cf91e61a5456747864c1b6fc01bb735..920bd872353109be0d2ca3115098164ac0390df9 100644
--- a/components/gcm_driver/gcm_client_impl.h
+++ b/components/gcm_driver/gcm_client_impl.h
@@ -6,6 +6,7 @@
#define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
#include <map>
+#include <set>
#include <string>
#include <vector>
@@ -101,6 +102,8 @@ class GCMClientImpl
virtual void SetRecording(bool recording) OVERRIDE;
virtual void ClearActivityLogs() OVERRIDE;
virtual GCMStatistics GetStatistics() const OVERRIDE;
+ virtual void SetAccountsForCheckin(
+ const std::map<std::string, std::string>& account_tokens) OVERRIDE;
// GCMStatsRecorder::Delegate implemenation.
virtual void OnActivityRecorded() OVERRIDE;
@@ -127,17 +130,27 @@ class GCMClientImpl
READY,
};
- // The check-in info for the user. Returned by the server.
+ // The check-in info for the device.
+ // TODO(fgorski): Convert to a class with explicit getters/setters.
struct CheckinInfo {
- CheckinInfo() : android_id(0), secret(0) {}
+ CheckinInfo();
+ ~CheckinInfo();
bool IsValid() const { return android_id != 0 && secret != 0; }
- void Reset() {
- android_id = 0;
- secret = 0;
- }
+ void SnapshotCheckinAccounts();
+ void Reset();
+ // Android ID of the device as assigned by the server.
uint64 android_id;
+ // Security token of the device as assigned by the server.
uint64 secret;
+ // True if accounts were already provided through SetAccountsForCheckin(),
+ // or when |last_checkin_accounts| was loaded as empty.
+ bool accounts_set;
+ // Map of account email addresses and OAuth2 tokens that will be sent to the
+ // checkin server on a next checkin.
+ std::map<std::string, std::string> account_tokens;
+ // As set of accounts last checkin was completed with.
+ std::set<std::string> last_checkin_accounts;
};
// Collection of pending registration requests. Keys are app IDs, while values
@@ -199,8 +212,8 @@ class GCMClientImpl
void SchedulePeriodicCheckin();
// Gets the time until next checkin.
base::TimeDelta GetTimeToNextCheckin() const;
- // Callback for setting last checkin time in the |gcm_store_|.
- void SetLastCheckinTimeCallback(bool success);
+ // Callback for setting last checkin information in the |gcm_store_|.
+ void SetLastCheckinInfoCallback(bool success);
// Callback for persisting device credentials in the |gcm_store_|.
void SetDeviceCredentialsCallback(bool success);
« no previous file with comments | « components/gcm_driver/gcm_client.h ('k') | components/gcm_driver/gcm_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698