| 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 | |
| 102 } // namespace | 89 } // namespace |
| 103 | 90 |
| 104 void SetGCMInternalsInfo(const gcm::GCMClient::GCMStatistics* stats, | 91 void SetGCMInternalsInfo(const gcm::GCMClient::GCMStatistics* stats, |
| 105 gcm::GCMProfileService* profile_service, | 92 gcm::GCMProfileService* profile_service, |
| 106 PrefService* prefs, | 93 PrefService* prefs, |
| 107 base::DictionaryValue* results) { | 94 base::DictionaryValue* results) { |
| 108 base::DictionaryValue* device_info = new base::DictionaryValue(); | 95 base::DictionaryValue* device_info = new base::DictionaryValue(); |
| 109 results->Set(kDeviceInfo, device_info); | 96 results->Set(kDeviceInfo, device_info); |
| 110 | 97 |
| 111 device_info->SetBoolean(kProfileServiceCreated, profile_service != NULL); | 98 device_info->SetBoolean(kProfileServiceCreated, profile_service != NULL); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 base::ListValue* receive_info = new base::ListValue(); | 137 base::ListValue* receive_info = new base::ListValue(); |
| 151 results->Set(kReceiveInfo, receive_info); | 138 results->Set(kReceiveInfo, receive_info); |
| 152 SetReceivingInfo(stats->recorded_activities.receiving_activities, | 139 SetReceivingInfo(stats->recorded_activities.receiving_activities, |
| 153 receive_info); | 140 receive_info); |
| 154 } | 141 } |
| 155 if (stats->recorded_activities.sending_activities.size() > 0) { | 142 if (stats->recorded_activities.sending_activities.size() > 0) { |
| 156 base::ListValue* send_info = new base::ListValue(); | 143 base::ListValue* send_info = new base::ListValue(); |
| 157 results->Set(kSendInfo, send_info); | 144 results->Set(kSendInfo, send_info); |
| 158 SetSendingInfo(stats->recorded_activities.sending_activities, send_info); | 145 SetSendingInfo(stats->recorded_activities.sending_activities, send_info); |
| 159 } | 146 } |
| 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 } | |
| 168 } | 147 } |
| 169 } | 148 } |
| 170 | 149 |
| 171 } // namespace gcm_driver | 150 } // namespace gcm_driver |
| OLD | NEW |