| 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 "chrome/browser/safe_browsing/srt_fetcher_win.h" | 5 #include "chrome/browser/safe_browsing/srt_fetcher_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 if (base::StringToUint(uws_string, &uws_id)) { | 265 if (base::StringToUint(uws_string, &uws_id)) { |
| 266 RecordSparseHistogram(kFoundUwsMetricName, uws_id); | 266 RecordSparseHistogram(kFoundUwsMetricName, uws_id); |
| 267 if (rappor_service) { | 267 if (rappor_service) { |
| 268 rappor_service->RecordSampleString(kFoundUwsMetricName, | 268 rappor_service->RecordSampleString(kFoundUwsMetricName, |
| 269 rappor::COARSE_RAPPOR_TYPE, | 269 rappor::COARSE_RAPPOR_TYPE, |
| 270 base::UTF16ToUTF8(uws_string)); | 270 base::UTF16ToUTF8(uws_string)); |
| 271 } | 271 } |
| 272 } else { | 272 } else { |
| 273 parse_error = true; | 273 parse_error = true; |
| 274 } | 274 } |
| 275 } |
| 275 | 276 |
| 276 // Clean up the old value. | 277 // Clean up the old value. |
| 277 reporter_key.DeleteValue(kFoundUwsValueName); | 278 reporter_key.DeleteValue(kFoundUwsValueName); |
| 278 | 279 RecordBooleanHistogram(kFoundUwsReadErrorMetricName, parse_error); |
| 279 RecordBooleanHistogram(kFoundUwsReadErrorMetricName, parse_error); | |
| 280 } | |
| 281 } | 280 } |
| 282 | 281 |
| 283 // Reports to UMA the memory usage of the software reporter tool as reported | 282 // Reports to UMA the memory usage of the software reporter tool as reported |
| 284 // by the tool itself in the Windows registry. | 283 // by the tool itself in the Windows registry. |
| 285 void ReportMemoryUsage() const { | 284 void ReportMemoryUsage() const { |
| 286 base::win::RegKey reporter_key; | 285 base::win::RegKey reporter_key; |
| 287 DWORD memory_used = 0; | 286 DWORD memory_used = 0; |
| 288 if (reporter_key.Open(HKEY_CURRENT_USER, registry_key_.c_str(), | 287 if (reporter_key.Open(HKEY_CURRENT_USER, registry_key_.c_str(), |
| 289 KEY_QUERY_VALUE | KEY_SET_VALUE) != ERROR_SUCCESS || | 288 KEY_QUERY_VALUE | KEY_SET_VALUE) != ERROR_SUCCESS || |
| 290 reporter_key.ReadValueDW(kMemoryUsedValueName, &memory_used) != | 289 reporter_key.ReadValueDW(kMemoryUsedValueName, &memory_used) != |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), | 1098 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), |
| 1100 KEY_QUERY_VALUE) == ERROR_SUCCESS && | 1099 KEY_QUERY_VALUE) == ERROR_SUCCESS && |
| 1101 srt_cleaner_key.GetValueCount() > 0; | 1100 srt_cleaner_key.GetValueCount() > 0; |
| 1102 } | 1101 } |
| 1103 | 1102 |
| 1104 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { | 1103 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { |
| 1105 g_testing_delegate_ = delegate; | 1104 g_testing_delegate_ = delegate; |
| 1106 } | 1105 } |
| 1107 | 1106 |
| 1108 } // namespace safe_browsing | 1107 } // namespace safe_browsing |
| OLD | NEW |