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

Unified Diff: google_apis/gcm/engine/account_mapping.h

Issue 443573002: [GCM] Adding status to AccountMapping structure (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renaming files from account_info to account_mapping 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 side-by-side diff with in-line comments
Download patch
Index: google_apis/gcm/engine/account_mapping.h
diff --git a/google_apis/gcm/engine/account_info.h b/google_apis/gcm/engine/account_mapping.h
similarity index 52%
rename from google_apis/gcm/engine/account_info.h
rename to google_apis/gcm/engine/account_mapping.h
index 94fe6d4e1762db2815dc6bc00cc55296c46b1e27..2d0da637dbebfcbffa3ddf3368e1cb4a0b506416 100644
--- a/google_apis/gcm/engine/account_info.h
+++ b/google_apis/gcm/engine/account_mapping.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef GOOGLE_APIS_GCM_ENGINE_ACCOUNT_INFO_H_
-#define GOOGLE_APIS_GCM_ENGINE_ACCOUNT_INFO_H_
+#ifndef GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_
+#define GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_
#include <string>
@@ -15,7 +15,20 @@ namespace gcm {
// Stores information about Account and a last message sent with the information
// about that account.
-struct GCM_EXPORT AccountInfo {
+struct GCM_EXPORT AccountMapping {
+ // Status of the account mapping.
+ enum MappingStatus {
+ NEW, // This is a new account mapping entry.
+ ADDING, // A mapping message has been sent, but it has not been confirmed
+ // yet.
+ MAPPED, // Account is mapped. At least one message has been confirmed to
+ // reached the GCM.
+ REMOVING, // Account is removed, but a message removing the mapping has not
+ // been confirmed yet.
+ REMOVED, // Account is removed, and at least one message has been
+ // confirmed to have reached the GCM.
+ };
+
// Indicates whether a message, if sent, was adding or removing account
// mapping.
enum MessageType {
@@ -24,26 +37,30 @@ struct GCM_EXPORT AccountInfo {
MSG_REMOVE, // Account mapping to device was removed by the message.
};
- AccountInfo();
- ~AccountInfo();
+ AccountMapping();
+ ~AccountMapping();
// Serializes account info to string without |account_id|.
std::string SerializeAsString() const;
// Parses account info from store, without |account_id|.
bool ParseFromString(const std::string& value);
- // Gaia ID of the account.
+ // Gaia ID of the account. (Acts as key for persistence.)
std::string account_id;
// Email address of the tracked account.
std::string email;
+ // OAuth2 access token used to authenticate mappings (not persisted).
+ std::string access_token;
+ // Status of the account mapping.
Nicolas Zea 2014/08/06 19:10:12 Aren't we not going to persist the mapping status
fgorski 2014/08/06 20:44:43 Done.
+ MappingStatus status;
+ // Time of the mapping status change.
+ base::Time status_change_timestamp;
// Type of the last mapping message sent to GCM.
MessageType last_message_type;
// ID of the last mapping message sent to GCM.
std::string last_message_id;
- // Timestamp of when the last mapping message was sent to GCM.
- base::Time last_message_timestamp;
};
} // namespace gcm
-#endif // GOOGLE_APIS_GCM_ENGINE_ACCOUNT_INFO_H_
+#endif // GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_

Powered by Google App Engine
This is Rietveld 408576698