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

Side by Side Diff: components/gcm_driver/gcm_stats_recorder_android.h

Issue 1616113003: List message decryption failures on chrome://gcm-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after CL 1619053003 Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_ 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_ 6 #define COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/gcm_driver/crypto/gcm_encryption_provider.h"
12 #include "components/gcm_driver/gcm_activity.h" 13 #include "components/gcm_driver/gcm_activity.h"
13 14
14 namespace gcm { 15 namespace gcm {
15 16
16 struct RecordedActivities;
17
18 // Stats recorder for Android, used for recording stats and activities on the 17 // Stats recorder for Android, used for recording stats and activities on the
19 // GCM Driver level for debugging purposes. Based on the GCMStatsRecorder, as 18 // GCM Driver level for debugging purposes. Based on the GCMStatsRecorder, as
20 // defined in the GCM Engine, which does not exist on Android. 19 // defined in the GCM Engine, which does not exist on Android.
20 //
21 // Note that this class, different from the GCMStatsRecorder(Impl), is expected
22 // to be used on the UI thread.
21 class GCMStatsRecorderAndroid { 23 class GCMStatsRecorderAndroid {
22 public: 24 public:
23 // A delegate interface that allows the GCMStatsRecorderAndroid instance to 25 // A delegate interface that allows the GCMStatsRecorderAndroid instance to
24 // interact with its container. 26 // interact with its container.
25 class Delegate { 27 class Delegate {
26 public: 28 public:
27 // Called when the GCMStatsRecorderAndroid is recording activities and a new 29 // Called when the GCMStatsRecorderAndroid is recording activities and a new
28 // activity has just been recorded. 30 // activity has just been recorded.
29 virtual void OnActivityRecorded() = 0; 31 virtual void OnActivityRecorded() = 0;
30 }; 32 };
(...skipping 19 matching lines...) Expand all
50 void RecordUnregistrationSent(const std::string& app_id); 52 void RecordUnregistrationSent(const std::string& app_id);
51 53
52 // Records that the unregistration sent for |app_id| has received a response. 54 // Records that the unregistration sent for |app_id| has received a response.
53 // |success| indicates whether the unregistration was successful. 55 // |success| indicates whether the unregistration was successful.
54 void RecordUnregistrationResponse(const std::string& app_id, bool success); 56 void RecordUnregistrationResponse(const std::string& app_id, bool success);
55 57
56 // Records that a data message has been received for |app_id|. 58 // Records that a data message has been received for |app_id|.
57 void RecordDataMessageReceived(const std::string& app_id, 59 void RecordDataMessageReceived(const std::string& app_id,
58 int message_byte_size); 60 int message_byte_size);
59 61
62 // Records a message decryption failure caused by |reason| for |app_id|.
63 void RecordDecryptionFailure(const std::string& app_id,
64 GCMEncryptionProvider::DecryptionFailure reason);
65
60 bool is_recording() const { return is_recording_; } 66 bool is_recording() const { return is_recording_; }
61 void set_is_recording(bool recording) { is_recording_ = recording; } 67 void set_is_recording(bool recording) { is_recording_ = recording; }
62 68
63 private: 69 private:
64 void RecordRegistration(const std::string& app_id, 70 void RecordRegistration(const std::string& app_id,
65 const std::string& event, 71 const std::string& event,
66 const std::string& details); 72 const std::string& details);
67 73
68 // Delegate made available by the container. May be a nullptr. 74 // Delegate made available by the container. May be a nullptr.
69 Delegate* delegate_; 75 Delegate* delegate_;
70 76
71 // Toggle determining whether the recorder is recording. 77 // Toggle determining whether the recorder is recording.
72 bool is_recording_ = false; 78 bool is_recording_ = false;
73 79
74 // Recorded registration activities (which includes unregistrations). 80 // Recorded registration activities (which includes unregistrations).
75 std::deque<RegistrationActivity> registration_activities_; 81 std::deque<RegistrationActivity> registration_activities_;
76 82
77 // Recorded received message activities. 83 // Recorded received message activities.
78 std::deque<ReceivingActivity> receiving_activities_; 84 std::deque<ReceivingActivity> receiving_activities_;
79 85
86 // Recorded message decryption failure activities.
87 std::deque<DecryptionFailureActivity> decryption_failure_activities_;
88
80 DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderAndroid); 89 DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderAndroid);
81 }; 90 };
82 91
83 } // namespace gcm 92 } // namespace gcm
84 93
85 #endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_ 94 #endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_internals_helper.cc ('k') | components/gcm_driver/gcm_stats_recorder_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698