| OLD | NEW |
| 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 #include "components/gcm_driver/gcm_internals_helper.h" | 5 #include "components/gcm_driver/gcm_internals_helper.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 row->AppendDouble(send.time.ToJsTime()); | 80 row->AppendDouble(send.time.ToJsTime()); |
| 81 row->AppendString(send.app_id); | 81 row->AppendString(send.app_id); |
| 82 row->AppendString(send.receiver_id); | 82 row->AppendString(send.receiver_id); |
| 83 row->AppendString(send.message_id); | 83 row->AppendString(send.message_id); |
| 84 row->AppendString(send.event); | 84 row->AppendString(send.event); |
| 85 row->AppendString(send.details); | 85 row->AppendString(send.details); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 void SetDecryptionFailureInfo( |
| 90 const std::vector<gcm::DecryptionFailureActivity>& failures, |
| 91 base::ListValue* failure_info) { |
| 92 for (const gcm::DecryptionFailureActivity& failure : failures) { |
| 93 base::ListValue* row = new base::ListValue(); |
| 94 failure_info->Append(row); |
| 95 |
| 96 row->AppendDouble(failure.time.ToJsTime()); |
| 97 row->AppendString(failure.app_id); |
| 98 row->AppendString(failure.details); |
| 99 } |
| 100 } |
| 101 |
| 89 } // namespace | 102 } // namespace |
| 90 | 103 |
| 91 void SetGCMInternalsInfo(const gcm::GCMClient::GCMStatistics* stats, | 104 void SetGCMInternalsInfo(const gcm::GCMClient::GCMStatistics* stats, |
| 92 gcm::GCMProfileService* profile_service, | 105 gcm::GCMProfileService* profile_service, |
| 93 PrefService* prefs, | 106 PrefService* prefs, |
| 94 base::DictionaryValue* results) { | 107 base::DictionaryValue* results) { |
| 95 base::DictionaryValue* device_info = new base::DictionaryValue(); | 108 base::DictionaryValue* device_info = new base::DictionaryValue(); |
| 96 results->Set(kDeviceInfo, device_info); | 109 results->Set(kDeviceInfo, device_info); |
| 97 | 110 |
| 98 device_info->SetBoolean(kProfileServiceCreated, profile_service != NULL); | 111 device_info->SetBoolean(kProfileServiceCreated, profile_service != NULL); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 base::ListValue* receive_info = new base::ListValue(); | 150 base::ListValue* receive_info = new base::ListValue(); |
| 138 results->Set(kReceiveInfo, receive_info); | 151 results->Set(kReceiveInfo, receive_info); |
| 139 SetReceivingInfo(stats->recorded_activities.receiving_activities, | 152 SetReceivingInfo(stats->recorded_activities.receiving_activities, |
| 140 receive_info); | 153 receive_info); |
| 141 } | 154 } |
| 142 if (stats->recorded_activities.sending_activities.size() > 0) { | 155 if (stats->recorded_activities.sending_activities.size() > 0) { |
| 143 base::ListValue* send_info = new base::ListValue(); | 156 base::ListValue* send_info = new base::ListValue(); |
| 144 results->Set(kSendInfo, send_info); | 157 results->Set(kSendInfo, send_info); |
| 145 SetSendingInfo(stats->recorded_activities.sending_activities, send_info); | 158 SetSendingInfo(stats->recorded_activities.sending_activities, send_info); |
| 146 } | 159 } |
| 160 |
| 161 if (stats->recorded_activities.decryption_failure_activities.size() > 0) { |
| 162 base::ListValue* failure_info = new base::ListValue(); |
| 163 results->Set(kDecryptionFailureInfo, failure_info); |
| 164 SetDecryptionFailureInfo( |
| 165 stats->recorded_activities.decryption_failure_activities, |
| 166 failure_info); |
| 167 } |
| 147 } | 168 } |
| 148 } | 169 } |
| 149 | 170 |
| 150 } // namespace gcm_driver | 171 } // namespace gcm_driver |
| OLD | NEW |