OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "chrome/browser/component_updater/sw_reporter_installer_win.h" | 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Get version number. | 203 // Get version number. |
204 if (cleaner_key.HasValue(kVersionValueName)) { | 204 if (cleaner_key.HasValue(kVersionValueName)) { |
205 DWORD version; | 205 DWORD version; |
206 cleaner_key.ReadValueDW(kVersionValueName, &version); | 206 cleaner_key.ReadValueDW(kVersionValueName, &version); |
207 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.Cleaner.Version", | 207 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.Cleaner.Version", |
208 version); | 208 version); |
209 cleaner_key.DeleteValue(kVersionValueName); | 209 cleaner_key.DeleteValue(kVersionValueName); |
210 } | 210 } |
211 // Get start & end time. If we don't have an end time, we can assume the | 211 // Get start & end time. If we don't have an end time, we can assume the |
212 // cleaner has not completed. | 212 // cleaner has not completed. |
213 int64 start_time_value; | 213 int64_t start_time_value; |
214 cleaner_key.ReadInt64(safe_browsing::kStartTimeValueName, | 214 cleaner_key.ReadInt64(safe_browsing::kStartTimeValueName, |
215 &start_time_value); | 215 &start_time_value); |
216 | 216 |
217 bool completed = cleaner_key.HasValue(safe_browsing::kEndTimeValueName); | 217 bool completed = cleaner_key.HasValue(safe_browsing::kEndTimeValueName); |
218 SRTHasCompleted(completed ? SRT_COMPLETED_YES : SRT_COMPLETED_NOT_YET); | 218 SRTHasCompleted(completed ? SRT_COMPLETED_YES : SRT_COMPLETED_NOT_YET); |
219 if (completed) { | 219 if (completed) { |
220 int64 end_time_value; | 220 int64_t end_time_value; |
221 cleaner_key.ReadInt64(safe_browsing::kEndTimeValueName, | 221 cleaner_key.ReadInt64(safe_browsing::kEndTimeValueName, |
222 &end_time_value); | 222 &end_time_value); |
223 cleaner_key.DeleteValue(safe_browsing::kEndTimeValueName); | 223 cleaner_key.DeleteValue(safe_browsing::kEndTimeValueName); |
224 base::TimeDelta run_time( | 224 base::TimeDelta run_time( |
225 base::Time::FromInternalValue(end_time_value) - | 225 base::Time::FromInternalValue(end_time_value) - |
226 base::Time::FromInternalValue(start_time_value)); | 226 base::Time::FromInternalValue(start_time_value)); |
227 UMA_HISTOGRAM_LONG_TIMES("SoftwareReporter.Cleaner.RunningTime", | 227 UMA_HISTOGRAM_LONG_TIMES("SoftwareReporter.Cleaner.RunningTime", |
228 run_time); | 228 run_time); |
229 } | 229 } |
230 // Get exit code. Assume nothing was found if we can't read the exit code. | 230 // Get exit code. Assume nothing was found if we can't read the exit code. |
231 DWORD exit_code = safe_browsing::kSwReporterNothingFound; | 231 DWORD exit_code = safe_browsing::kSwReporterNothingFound; |
232 if (cleaner_key.HasValue(kExitCodeValueName)) { | 232 if (cleaner_key.HasValue(kExitCodeValueName)) { |
233 cleaner_key.ReadValueDW(kExitCodeValueName, &exit_code); | 233 cleaner_key.ReadValueDW(kExitCodeValueName, &exit_code); |
234 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.Cleaner.ExitCode", | 234 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.Cleaner.ExitCode", |
235 exit_code); | 235 exit_code); |
236 cleaner_key.DeleteValue(kExitCodeValueName); | 236 cleaner_key.DeleteValue(kExitCodeValueName); |
237 } | 237 } |
238 cleaner_key.DeleteValue(safe_browsing::kStartTimeValueName); | 238 cleaner_key.DeleteValue(safe_browsing::kStartTimeValueName); |
239 | 239 |
240 if (exit_code == safe_browsing::kSwReporterPostRebootCleanupNeeded || | 240 if (exit_code == safe_browsing::kSwReporterPostRebootCleanupNeeded || |
241 exit_code == | 241 exit_code == |
242 safe_browsing::kSwReporterDelayedPostRebootCleanupNeeded) { | 242 safe_browsing::kSwReporterDelayedPostRebootCleanupNeeded) { |
243 // Check if we are running after the user has rebooted. | 243 // Check if we are running after the user has rebooted. |
244 base::TimeDelta elapsed( | 244 base::TimeDelta elapsed( |
245 base::Time::Now() - | 245 base::Time::Now() - |
246 base::Time::FromInternalValue(start_time_value)); | 246 base::Time::FromInternalValue(start_time_value)); |
247 DCHECK_GT(elapsed.InMilliseconds(), 0); | 247 DCHECK_GT(elapsed.InMilliseconds(), 0); |
248 UMA_HISTOGRAM_BOOLEAN( | 248 UMA_HISTOGRAM_BOOLEAN( |
249 "SoftwareReporter.Cleaner.HasRebooted", | 249 "SoftwareReporter.Cleaner.HasRebooted", |
250 static_cast<uint64>(elapsed.InMilliseconds()) > ::GetTickCount()); | 250 static_cast<uint64_t>(elapsed.InMilliseconds()) > ::GetTickCount()); |
251 } | 251 } |
252 | 252 |
253 if (cleaner_key.HasValue(kUploadResultsValueName)) { | 253 if (cleaner_key.HasValue(kUploadResultsValueName)) { |
254 base::string16 upload_results; | 254 base::string16 upload_results; |
255 cleaner_key.ReadValue(kUploadResultsValueName, &upload_results); | 255 cleaner_key.ReadValue(kUploadResultsValueName, &upload_results); |
256 ReportUploadsWithUma(upload_results); | 256 ReportUploadsWithUma(upload_results); |
257 } | 257 } |
258 } else { | 258 } else { |
259 if (cleaner_key.HasValue(safe_browsing::kEndTimeValueName)) { | 259 if (cleaner_key.HasValue(safe_browsing::kEndTimeValueName)) { |
260 SRTHasCompleted(SRT_COMPLETED_LATER); | 260 SRTHasCompleted(SRT_COMPLETED_LATER); |
(...skipping 17 matching lines...) Expand all Loading... |
278 } | 278 } |
279 | 279 |
280 void RegisterProfilePrefsForSwReporter( | 280 void RegisterProfilePrefsForSwReporter( |
281 user_prefs::PrefRegistrySyncable* registry) { | 281 user_prefs::PrefRegistrySyncable* registry) { |
282 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); | 282 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); |
283 | 283 |
284 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); | 284 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); |
285 } | 285 } |
286 | 286 |
287 } // namespace component_updater | 287 } // namespace component_updater |
OLD | NEW |