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

Side by Side Diff: chrome/browser/safe_browsing/srt_fetcher_win.cc

Issue 1548133002: Switch to standard integer types in chrome/browser/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 #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>
8
7 #include <vector> 9 #include <vector>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
11 #include "base/callback_helpers.h" 13 #include "base/callback_helpers.h"
12 #include "base/command_line.h" 14 #include "base/command_line.h"
13 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/macros.h"
14 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
16 #include "base/metrics/sparse_histogram.h" 19 #include "base/metrics/sparse_histogram.h"
17 #include "base/prefs/pref_service.h" 20 #include "base/prefs/pref_service.h"
18 #include "base/process/launch.h" 21 #include "base/process/launch.h"
19 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
21 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
22 #include "base/task_runner_util.h" 25 #include "base/task_runner_util.h"
23 #include "base/threading/thread_checker.h" 26 #include "base/threading/thread_checker.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 base::win::RegKey reporter_key( 342 base::win::RegKey reporter_key(
340 HKEY_CURRENT_USER, kSoftwareRemovalToolRegistryKey, KEY_ALL_ACCESS); 343 HKEY_CURRENT_USER, kSoftwareRemovalToolRegistryKey, KEY_ALL_ACCESS);
341 if (!reporter_key.Valid()) { 344 if (!reporter_key.Valid()) {
342 UMA_HISTOGRAM_ENUMERATION(kRunningTimeErrorMetricName, 345 UMA_HISTOGRAM_ENUMERATION(kRunningTimeErrorMetricName,
343 REPORTER_RUNNING_TIME_ERROR_REGISTRY_KEY_INVALID, 346 REPORTER_RUNNING_TIME_ERROR_REGISTRY_KEY_INVALID,
344 REPORTER_RUNNING_TIME_ERROR_MAX); 347 REPORTER_RUNNING_TIME_ERROR_MAX);
345 return; 348 return;
346 } 349 }
347 350
348 bool has_start_time = false; 351 bool has_start_time = false;
349 int64 start_time_value = 0; 352 int64_t start_time_value = 0;
350 if (reporter_key.HasValue(kStartTimeValueName) && 353 if (reporter_key.HasValue(kStartTimeValueName) &&
351 reporter_key.ReadInt64(kStartTimeValueName, &start_time_value) == 354 reporter_key.ReadInt64(kStartTimeValueName, &start_time_value) ==
352 ERROR_SUCCESS) { 355 ERROR_SUCCESS) {
353 has_start_time = true; 356 has_start_time = true;
354 reporter_key.DeleteValue(kStartTimeValueName); 357 reporter_key.DeleteValue(kStartTimeValueName);
355 } 358 }
356 359
357 bool has_end_time = false; 360 bool has_end_time = false;
358 int64 end_time_value = 0; 361 int64_t end_time_value = 0;
359 if (reporter_key.HasValue(kEndTimeValueName) && 362 if (reporter_key.HasValue(kEndTimeValueName) &&
360 reporter_key.ReadInt64(kEndTimeValueName, &end_time_value) == 363 reporter_key.ReadInt64(kEndTimeValueName, &end_time_value) ==
361 ERROR_SUCCESS) { 364 ERROR_SUCCESS) {
362 has_end_time = true; 365 has_end_time = true;
363 reporter_key.DeleteValue(kEndTimeValueName); 366 reporter_key.DeleteValue(kEndTimeValueName);
364 } 367 }
365 368
366 if (has_start_time && has_end_time) { 369 if (has_start_time && has_end_time) {
367 base::TimeDelta registry_run_time = 370 base::TimeDelta registry_run_time =
368 base::Time::FromInternalValue(end_time_value) - 371 base::Time::FromInternalValue(end_time_value) -
(...skipping 22 matching lines...) Expand all
391 void ReportSwReporterScanTimes() { 394 void ReportSwReporterScanTimes() {
392 base::string16 scan_times_key_path = base::StringPrintf( 395 base::string16 scan_times_key_path = base::StringPrintf(
393 L"%ls\\%ls", kSoftwareRemovalToolRegistryKey, kScanTimesSubKey); 396 L"%ls\\%ls", kSoftwareRemovalToolRegistryKey, kScanTimesSubKey);
394 base::win::RegKey scan_times_key(HKEY_CURRENT_USER, 397 base::win::RegKey scan_times_key(HKEY_CURRENT_USER,
395 scan_times_key_path.c_str(), KEY_ALL_ACCESS); 398 scan_times_key_path.c_str(), KEY_ALL_ACCESS);
396 if (!scan_times_key.Valid()) 399 if (!scan_times_key.Valid())
397 return; 400 return;
398 401
399 base::string16 value_name; 402 base::string16 value_name;
400 int uws_id = 0; 403 int uws_id = 0;
401 int64 raw_scan_time = 0; 404 int64_t raw_scan_time = 0;
402 int num_scan_times = scan_times_key.GetValueCount(); 405 int num_scan_times = scan_times_key.GetValueCount();
403 for (int i = 0; i < num_scan_times; ++i) { 406 for (int i = 0; i < num_scan_times; ++i) {
404 if (scan_times_key.GetValueNameAt(i, &value_name) == ERROR_SUCCESS && 407 if (scan_times_key.GetValueNameAt(i, &value_name) == ERROR_SUCCESS &&
405 base::StringToInt(value_name, &uws_id) && 408 base::StringToInt(value_name, &uws_id) &&
406 scan_times_key.ReadInt64(value_name.c_str(), &raw_scan_time) == 409 scan_times_key.ReadInt64(value_name.c_str(), &raw_scan_time) ==
407 ERROR_SUCCESS) { 410 ERROR_SUCCESS) {
408 base::TimeDelta scan_time = 411 base::TimeDelta scan_time =
409 base::TimeDelta::FromInternalValue(raw_scan_time); 412 base::TimeDelta::FromInternalValue(raw_scan_time);
410 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( 413 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet(
411 kScanTimesMetricName, base::HistogramBase::kUmaTargetedHistogramFlag); 414 kScanTimesMetricName, base::HistogramBase::kUmaTargetedHistogramFlag);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 611
609 void SetReporterLauncherForTesting(const ReporterLauncher& reporter_launcher) { 612 void SetReporterLauncherForTesting(const ReporterLauncher& reporter_launcher) {
610 g_reporter_launcher_ = reporter_launcher; 613 g_reporter_launcher_ = reporter_launcher;
611 } 614 }
612 615
613 void SetPromptTriggerForTesting(const PromptTrigger& prompt_trigger) { 616 void SetPromptTriggerForTesting(const PromptTrigger& prompt_trigger) {
614 g_prompt_trigger_ = prompt_trigger; 617 g_prompt_trigger_ = prompt_trigger;
615 } 618 }
616 619
617 } // namespace safe_browsing 620 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/signature_evaluator_mac_unittest.cc ('k') | chrome/browser/safe_browsing/srt_global_error_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698