Roll src/third_party/WebKit 3529d49:06e8485 (svn 202554:202555)
[chromium-blink-merge.git] / google_apis / gcm / engine / account_mapping.h
bloba152d5671d997d3175cfb321d777e6c73a0675e3
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
3 // found in the LICENSE file.
5 #ifndef GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_
6 #define GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/time/time.h"
12 #include "google_apis/gcm/base/gcm_export.h"
14 namespace gcm {
16 // Stores information about Account mapping and a last message sent regarding
17 // that mapping.
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.
30 AccountMapping();
31 ~AccountMapping();
33 // Serializes account mapping to string without |account_id|, |status| or
34 // |access_token|.
35 std::string SerializeAsString() const;
36 // Parses account mapping from store, without |account_id| or |access_token|.
37 // |status| is infered.
38 bool ParseFromString(const std::string& value);
40 // Gaia ID of the account. (Acts as key for persistence.)
41 std::string account_id;
42 // Email address of the tracked account.
43 std::string email;
44 // OAuth2 access token used to authenticate mappings (not persisted).
45 std::string access_token;
46 // Status of the account mapping (not persisted).
47 MappingStatus status;
48 // Time of the mapping status change.
49 base::Time status_change_timestamp;
50 // ID of the last mapping message sent to GCM.
51 std::string last_message_id;
54 } // namespace gcm
56 #endif // GOOGLE_APIS_GCM_ENGINE_ACCOUNT_MAPPING_H_