gcm_activity.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.
  4. #ifndef COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_
  5. #define COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/time/time.h"
  9. namespace gcm {
  10. // Contains data that are common to all activity kinds below.
  11. struct Activity {
  12. Activity();
  13. virtual ~Activity();
  14. base::Time time;
  15. std::string event; // A short description of the event.
  16. std::string details; // Any additional detail about the event.
  17. };
  18. // Contains relevant data of a connection activity.
  19. struct ConnectionActivity : Activity {
  20. ConnectionActivity();
  21. ~ConnectionActivity() override;
  22. };
  23. // Contains relevant data of a check-in activity.
  24. struct CheckinActivity : Activity {
  25. CheckinActivity();
  26. ~CheckinActivity() override;
  27. };
  28. // Contains relevant data of a registration/unregistration step.
  29. struct RegistrationActivity : Activity {
  30. RegistrationActivity();
  31. ~RegistrationActivity() override;
  32. std::string app_id;
  33. // For GCM, comma separated sender ids. For Instance ID, authorized entity.
  34. std::string source;
  35. };
  36. // Contains relevant data of a message receiving event.
  37. struct ReceivingActivity : Activity {
  38. ReceivingActivity();
  39. ~ReceivingActivity() override;
  40. std::string app_id;
  41. std::string from;
  42. int message_byte_size;
  43. };
  44. // Contains relevant data of a send-message step.
  45. struct SendingActivity : Activity {
  46. SendingActivity();
  47. ~SendingActivity() override;
  48. std::string app_id;
  49. std::string receiver_id;
  50. std::string message_id;
  51. };
  52. // Contains relevant data of a message decryption failure.
  53. struct DecryptionFailureActivity : Activity {
  54. DecryptionFailureActivity();
  55. ~DecryptionFailureActivity() override;
  56. std::string app_id;
  57. };
  58. struct RecordedActivities {
  59. RecordedActivities();
  60. RecordedActivities(const RecordedActivities& other);
  61. virtual ~RecordedActivities();
  62. std::vector<CheckinActivity> checkin_activities;
  63. std::vector<ConnectionActivity> connection_activities;
  64. std::vector<RegistrationActivity> registration_activities;
  65. std::vector<ReceivingActivity> receiving_activities;
  66. std::vector<SendingActivity> sending_activities;
  67. std::vector<DecryptionFailureActivity> decryption_failure_activities;
  68. };
  69. } // namespace gcm
  70. #endif // COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_