 Chromium Code Reviews
 Chromium Code Reviews Issue 443573002:
  [GCM] Adding status to AccountMapping structure  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 443573002:
  [GCM] Adding status to AccountMapping structure  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| OLD | NEW | 
|---|---|
| 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 GOOGLE_APIS_GCM_ENGINE_ACCOUNT_INFO_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_ | 
| 6 #define GOOGLE_APIS_GCM_ENGINE_ACCOUNT_INFO_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" | 
| 12 #include "google_apis/gcm/base/gcm_export.h" | 12 #include "google_apis/gcm/base/gcm_export.h" | 
| 13 | 13 | 
| 14 namespace gcm { | 14 namespace gcm { | 
| 15 | 15 | 
| 16 // Stores information about Account and a last message sent with the information | 16 // Stores information about Account and a last message sent with the information | 
| 17 // about that account. | 17 // about that account. | 
| 18 struct GCM_EXPORT AccountInfo { | 18 struct GCM_EXPORT AccountMapping { | 
| 19 // Status of the account mapping. | |
| 20 enum MappingStatus { | |
| 21 NEW, // This is a new account mapping entry. | |
| 22 ADDING, // A mapping message has been sent, but it has not been confirmed | |
| 23 // yet. | |
| 24 MAPPED, // Account is mapped. At least one message has been confirmed to | |
| 25 // reached the GCM. | |
| 26 REMOVING, // Account is removed, but a message removing the mapping has not | |
| 27 // been confirmed yet. | |
| 28 REMOVED, // Account is removed, and at least one message has been | |
| 29 // confirmed to have reached the GCM. | |
| 30 }; | |
| 31 | |
| 19 // Indicates whether a message, if sent, was adding or removing account | 32 // Indicates whether a message, if sent, was adding or removing account | 
| 20 // mapping. | 33 // mapping. | 
| 21 enum MessageType { | 34 enum MessageType { | 
| 22 MSG_NONE, // No message has been sent. | 35 MSG_NONE, // No message has been sent. | 
| 23 MSG_ADD, // Account was mapped to device by the message. | 36 MSG_ADD, // Account was mapped to device by the message. | 
| 24 MSG_REMOVE, // Account mapping to device was removed by the message. | 37 MSG_REMOVE, // Account mapping to device was removed by the message. | 
| 25 }; | 38 }; | 
| 26 | 39 | 
| 27 AccountInfo(); | 40 AccountMapping(); | 
| 28 ~AccountInfo(); | 41 ~AccountMapping(); | 
| 29 | 42 | 
| 30 // Serializes account info to string without |account_id|. | 43 // Serializes account info to string without |account_id|. | 
| 31 std::string SerializeAsString() const; | 44 std::string SerializeAsString() const; | 
| 32 // Parses account info from store, without |account_id|. | 45 // Parses account info from store, without |account_id|. | 
| 33 bool ParseFromString(const std::string& value); | 46 bool ParseFromString(const std::string& value); | 
| 34 | 47 | 
| 35 // Gaia ID of the account. | 48 // Gaia ID of the account. (Acts as key for persistence.) | 
| 36 std::string account_id; | 49 std::string account_id; | 
| 37 // Email address of the tracked account. | 50 // Email address of the tracked account. | 
| 38 std::string email; | 51 std::string email; | 
| 52 // OAuth2 access token used to authenticate mappings (not persisted). | |
| 53 std::string access_token; | |
| 54 // 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.
 | |
| 55 MappingStatus status; | |
| 56 // Time of the mapping status change. | |
| 57 base::Time status_change_timestamp; | |
| 39 // Type of the last mapping message sent to GCM. | 58 // Type of the last mapping message sent to GCM. | 
| 40 MessageType last_message_type; | 59 MessageType last_message_type; | 
| 41 // ID of the last mapping message sent to GCM. | 60 // ID of the last mapping message sent to GCM. | 
| 42 std::string last_message_id; | 61 std::string last_message_id; | 
| 43 // Timestamp of when the last mapping message was sent to GCM. | |
| 44 base::Time last_message_timestamp; | |
| 45 }; | 62 }; | 
| 46 | 63 | 
| 47 } // namespace gcm | 64 } // namespace gcm | 
| 48 | 65 | 
| 49 #endif // GOOGLE_APIS_GCM_ENGINE_ACCOUNT_INFO_H_ | 66 #endif // GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_ | 
| OLD | NEW |