| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 L"Software\\Google\\Software Removal Tool"; | 65 L"Software\\Google\\Software Removal Tool"; |
| 66 | 66 |
| 67 const wchar_t kCleanerSubKey[] = L"Cleaner"; | 67 const wchar_t kCleanerSubKey[] = L"Cleaner"; |
| 68 | 68 |
| 69 const wchar_t kEndTimeValueName[] = L"EndTime"; | 69 const wchar_t kEndTimeValueName[] = L"EndTime"; |
| 70 const wchar_t kStartTimeValueName[] = L"StartTime"; | 70 const wchar_t kStartTimeValueName[] = L"StartTime"; |
| 71 | 71 |
| 72 const char kExtendedSafeBrowsingEnabledSwitch[] = | 72 const char kExtendedSafeBrowsingEnabledSwitch[] = |
| 73 "extended-safebrowsing-enabled"; | 73 "extended-safebrowsing-enabled"; |
| 74 | 74 |
| 75 const base::Feature kSwReporterExtendedSafeBrowsingFeature{ | |
| 76 "SwReporterExtendedSafeBrowsingFeature", base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 77 | |
| 78 namespace { | 75 namespace { |
| 79 | 76 |
| 80 // Used to send UMA information about missing start and end time registry | 77 // Used to send UMA information about missing start and end time registry |
| 81 // values for the reporter. Replicated in the histograms.xml file, so the order | 78 // values for the reporter. Replicated in the histograms.xml file, so the order |
| 82 // MUST NOT CHANGE. | 79 // MUST NOT CHANGE. |
| 83 enum SwReporterRunningTimeRegistryError { | 80 enum SwReporterRunningTimeRegistryError { |
| 84 REPORTER_RUNNING_TIME_ERROR_NO_ERROR = 0, | 81 REPORTER_RUNNING_TIME_ERROR_NO_ERROR = 0, |
| 85 REPORTER_RUNNING_TIME_ERROR_REGISTRY_KEY_INVALID = 1, | 82 REPORTER_RUNNING_TIME_ERROR_REGISTRY_KEY_INVALID = 1, |
| 86 REPORTER_RUNNING_TIME_ERROR_MISSING_START_TIME = 2, | 83 REPORTER_RUNNING_TIME_ERROR_MISSING_START_TIME = 2, |
| 87 REPORTER_RUNNING_TIME_ERROR_MISSING_END_TIME = 3, | 84 REPORTER_RUNNING_TIME_ERROR_MISSING_END_TIME = 3, |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), | 941 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), |
| 945 next_trigger - now); | 942 next_trigger - now); |
| 946 } | 943 } |
| 947 } | 944 } |
| 948 | 945 |
| 949 // Returns true if the experiment to send reporter logs is enabled, the user | 946 // Returns true if the experiment to send reporter logs is enabled, the user |
| 950 // opted into Safe Browsing extended reporting, and logs have been sent at | 947 // opted into Safe Browsing extended reporting, and logs have been sent at |
| 951 // least |kSwReporterLastTimeSentReport| days ago. | 948 // least |kSwReporterLastTimeSentReport| days ago. |
| 952 bool ShouldSendReporterLogs(const std::string& suffix, | 949 bool ShouldSendReporterLogs(const std::string& suffix, |
| 953 const PrefService& local_state) { | 950 const PrefService& local_state) { |
| 954 if (!base::FeatureList::IsEnabled(kSwReporterExtendedSafeBrowsingFeature)) | |
| 955 return false; | |
| 956 | |
| 957 UMAHistogramReporter uma(suffix); | 951 UMAHistogramReporter uma(suffix); |
| 958 if (!SafeBrowsingExtendedReportingEnabled()) { | 952 if (!SafeBrowsingExtendedReportingEnabled()) { |
| 959 uma.RecordLogsUploadEnabled(REPORTER_LOGS_UPLOADS_SBER_DISABLED); | 953 uma.RecordLogsUploadEnabled(REPORTER_LOGS_UPLOADS_SBER_DISABLED); |
| 960 return false; | 954 return false; |
| 961 } | 955 } |
| 962 | 956 |
| 963 const base::Time now = base::Time::Now(); | 957 const base::Time now = base::Time::Now(); |
| 964 const base::Time last_time_sent_logs = base::Time::FromInternalValue( | 958 const base::Time last_time_sent_logs = base::Time::FromInternalValue( |
| 965 local_state.GetInt64(prefs::kSwReporterLastTimeSentReport)); | 959 local_state.GetInt64(prefs::kSwReporterLastTimeSentReport)); |
| 966 const base::Time next_time_send_logs = | 960 const base::Time next_time_send_logs = |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), | 1092 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), |
| 1099 KEY_QUERY_VALUE) == ERROR_SUCCESS && | 1093 KEY_QUERY_VALUE) == ERROR_SUCCESS && |
| 1100 srt_cleaner_key.GetValueCount() > 0; | 1094 srt_cleaner_key.GetValueCount() > 0; |
| 1101 } | 1095 } |
| 1102 | 1096 |
| 1103 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { | 1097 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { |
| 1104 g_testing_delegate_ = delegate; | 1098 g_testing_delegate_ = delegate; |
| 1105 } | 1099 } |
| 1106 | 1100 |
| 1107 } // namespace safe_browsing | 1101 } // namespace safe_browsing |
| OLD | NEW |