blob: 80c9d0316f978d7c1d429fd3528dd7d6711d9bf3 [file] [log] [blame]
[email protected]5da93802014-05-24 01:35:011// 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.
4
[email protected]cd57f372014-06-09 17:13:065#ifndef COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_
6#define COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_
[email protected]5da93802014-05-24 01:35:017
8#include <string>
9#include <vector>
10
11#include "base/time/time.h"
[email protected]5da93802014-05-24 01:35:0112
13namespace gcm {
14
15// Contains data that are common to all activity kinds below.
[email protected]cd57f372014-06-09 17:13:0616struct Activity {
[email protected]5da93802014-05-24 01:35:0117 Activity();
18 virtual ~Activity();
19
20 base::Time time;
21 std::string event; // A short description of the event.
22 std::string details; // Any additional detail about the event.
23};
24
25// Contains relevant data of a connection activity.
[email protected]cd57f372014-06-09 17:13:0626struct ConnectionActivity : Activity {
[email protected]5da93802014-05-24 01:35:0127 ConnectionActivity();
dcheng00ea022b2014-10-21 11:24:5628 ~ConnectionActivity() override;
[email protected]5da93802014-05-24 01:35:0129};
30
31// Contains relevant data of a check-in activity.
[email protected]cd57f372014-06-09 17:13:0632struct CheckinActivity : Activity {
[email protected]5da93802014-05-24 01:35:0133 CheckinActivity();
dcheng00ea022b2014-10-21 11:24:5634 ~CheckinActivity() override;
[email protected]5da93802014-05-24 01:35:0135};
36
37// Contains relevant data of a registration/unregistration step.
[email protected]cd57f372014-06-09 17:13:0638struct RegistrationActivity : Activity {
[email protected]5da93802014-05-24 01:35:0139 RegistrationActivity();
dcheng00ea022b2014-10-21 11:24:5640 ~RegistrationActivity() override;
[email protected]5da93802014-05-24 01:35:0141
42 std::string app_id;
jianlifc047f32015-06-26 22:29:0143 // For GCM, comma separated sender ids. For Instance ID, authorized entity.
44 std::string source;
[email protected]5da93802014-05-24 01:35:0145};
46
47// Contains relevant data of a message receiving event.
[email protected]cd57f372014-06-09 17:13:0648struct ReceivingActivity : Activity {
[email protected]5da93802014-05-24 01:35:0149 ReceivingActivity();
dcheng00ea022b2014-10-21 11:24:5650 ~ReceivingActivity() override;
[email protected]5da93802014-05-24 01:35:0151
52 std::string app_id;
53 std::string from;
54 int message_byte_size;
55};
56
57// Contains relevant data of a send-message step.
[email protected]cd57f372014-06-09 17:13:0658struct SendingActivity : Activity {
[email protected]5da93802014-05-24 01:35:0159 SendingActivity();
dcheng00ea022b2014-10-21 11:24:5660 ~SendingActivity() override;
[email protected]5da93802014-05-24 01:35:0161
62 std::string app_id;
63 std::string receiver_id;
64 std::string message_id;
65};
66
peteree284ba52016-02-01 11:53:2867// Contains relevant data of a message decryption failure.
68struct DecryptionFailureActivity : Activity {
69 DecryptionFailureActivity();
70 ~DecryptionFailureActivity() override;
71
72 std::string app_id;
73};
74
[email protected]cd57f372014-06-09 17:13:0675struct RecordedActivities {
[email protected]5da93802014-05-24 01:35:0176 RecordedActivities();
vmpstrb6449d512016-02-25 23:55:4077 RecordedActivities(const RecordedActivities& other);
[email protected]5da93802014-05-24 01:35:0178 virtual ~RecordedActivities();
79
80 std::vector<CheckinActivity> checkin_activities;
81 std::vector<ConnectionActivity> connection_activities;
82 std::vector<RegistrationActivity> registration_activities;
83 std::vector<ReceivingActivity> receiving_activities;
84 std::vector<SendingActivity> sending_activities;
peteree284ba52016-02-01 11:53:2885 std::vector<DecryptionFailureActivity> decryption_failure_activities;
[email protected]5da93802014-05-24 01:35:0186};
87
88} // namespace gcm
89
[email protected]cd57f372014-06-09 17:13:0690#endif // COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_