Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 #include "net/http/http_status_code.h" | 50 #include "net/http/http_status_code.h" |
| 51 #include "net/url_request/url_fetcher.h" | 51 #include "net/url_request/url_fetcher.h" |
| 52 #include "net/url_request/url_fetcher_delegate.h" | 52 #include "net/url_request/url_fetcher_delegate.h" |
| 53 #include "net/url_request/url_request_context_getter.h" | 53 #include "net/url_request/url_request_context_getter.h" |
| 54 | 54 |
| 55 using content::BrowserThread; | 55 using content::BrowserThread; |
| 56 | 56 |
| 57 namespace safe_browsing { | 57 namespace safe_browsing { |
| 58 | 58 |
| 59 const wchar_t kSoftwareRemovalToolRegistryKey[] = | 59 const wchar_t kSoftwareRemovalToolRegistryKey[] = |
| 60 L"Software\\Google\\Software Removal Tool"; | 60 L"Software\\Google\\Software Removal Tool"; |
|
grt (UTC plus 2)
2016/09/16 15:59:20
is this key used by Google Chrome, Google Chrome S
ftirelo
2016/09/16 19:26:55
Good catch! Thanks for noticing the issue!
The Sw
| |
| 61 | 61 |
| 62 const wchar_t kCleanerSubKey[] = L"Cleaner"; | 62 const wchar_t kCleanerSubKey[] = L"Cleaner"; |
| 63 | 63 |
| 64 const wchar_t kEndTimeValueName[] = L"EndTime"; | 64 const wchar_t kEndTimeValueName[] = L"EndTime"; |
| 65 const wchar_t kStartTimeValueName[] = L"StartTime"; | 65 const wchar_t kStartTimeValueName[] = L"StartTime"; |
| 66 | 66 |
| 67 const char kExtendedSafeBrowsingEnabledSwitch[] = | 67 const char kExtendedSafeBrowsingEnabledSwitch[] = |
| 68 "extended-safebrowsing-enabled"; | 68 "extended-safebrowsing-enabled"; |
| 69 | 69 |
| 70 const base::Feature kSwReporterExtendedSafeBrowsingFeature{ | 70 const base::Feature kSwReporterExtendedSafeBrowsingFeature{ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 SW_REPORTER_NO_LOCAL_STATE = 9, | 105 SW_REPORTER_NO_LOCAL_STATE = 9, |
| 106 SW_REPORTER_NO_PROMPT_NEEDED = 10, | 106 SW_REPORTER_NO_PROMPT_NEEDED = 10, |
| 107 SW_REPORTER_NO_PROMPT_FIELD_TRIAL = 11, | 107 SW_REPORTER_NO_PROMPT_FIELD_TRIAL = 11, |
| 108 SW_REPORTER_ALREADY_PROMPTED = 12, | 108 SW_REPORTER_ALREADY_PROMPTED = 12, |
| 109 SW_REPORTER_RAN_DAILY = 13, | 109 SW_REPORTER_RAN_DAILY = 13, |
| 110 SW_REPORTER_ADDED_TO_MENU = 14, | 110 SW_REPORTER_ADDED_TO_MENU = 14, |
| 111 | 111 |
| 112 SW_REPORTER_MAX, | 112 SW_REPORTER_MAX, |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // Used to send UMA information if Software Reporter logs uploads are enabled. | |
|
Joe Mason
2016/09/16 14:57:13
"if" makes it sound like this is only sent if uplo
ftirelo
2016/09/16 15:34:42
Done.
| |
| 116 // Replicated in the histograms.xml file, so the order MUST NOT CHANGE. | |
| 117 enum SwReporterLogsUploadsEnabled { | |
| 118 REPORTER_LOGS_UPLOADS_ENABLED = 0, | |
| 119 REPORTER_LOGS_UPLOADS_SBER_DISABLED = 1, | |
| 120 REPORTER_LOGS_UPLOADS_RECENTLY_SENT_LOGS = 2, | |
| 121 REPORTER_LOGS_UPLOADS_MAX, | |
| 122 }; | |
| 123 | |
| 124 // Used to send UMA information about the result of Software Reporter attempt to | |
| 125 // uppload logs, when logs are enabled. Replicated in the histograms.xml file, | |
|
Joe Mason
2016/09/16 14:57:13
Typos: "Reporter's attempt". "upload" logs.
ftirelo
2016/09/16 15:34:42
Done.
| |
| 126 // so the order MUST NOT CHANGE. | |
| 127 enum SwReporterLogsUploadsResult { | |
|
grt (UTC plus 2)
2016/09/16 15:59:20
...LogsUploadResult?
ftirelo
2016/09/16 19:26:55
Done.
| |
| 128 REPORTER_LOGS_UPLOADS_RESULT_SUCCESS = 0, | |
|
grt (UTC plus 2)
2016/09/16 15:59:20
it appears that the only value used is REPORTER_LO
grt (UTC plus 2)
2016/09/16 15:59:20
...LOGS_UPLOAD_RESULT...?
ftirelo
2016/09/16 19:26:55
Since there is no central place accessible by Chro
ftirelo
2016/09/16 19:26:55
Done.
| |
| 129 REPORTER_LOGS_UPLOADS_RESULT_REQUEST_FAILED = 1, | |
| 130 REPORTER_LOGS_UPLOADS_RESULT_INVALID_RESPONSE = 2, | |
| 131 REPORTER_LOGS_UPLOADS_RESULT_TIMED_OUT = 3, | |
| 132 REPORTER_LOGS_UPLOADS_RESULT_INTERNAL_ERROR = 4, | |
| 133 REPORTER_LOGS_UPLOADS_RESULT_REPORT_TOO_LARGE = 5, | |
| 134 REPORTER_LOGS_UPLOADS_RESULT_NO_NETWORK = 6, | |
| 135 REPORTER_LOGS_UPLOADS_RESULT_MAX, | |
| 136 }; | |
| 137 | |
| 115 const char kRunningTimeErrorMetricName[] = | 138 const char kRunningTimeErrorMetricName[] = |
| 116 "SoftwareReporter.RunningTimeRegistryError"; | 139 "SoftwareReporter.RunningTimeRegistryError"; |
| 117 | 140 |
| 118 SwReporterTestingDelegate* g_testing_delegate_ = nullptr; | 141 SwReporterTestingDelegate* g_testing_delegate_ = nullptr; |
| 119 | 142 |
| 120 const wchar_t kScanTimesSubKey[] = L"ScanTimes"; | 143 const wchar_t kScanTimesSubKey[] = L"ScanTimes"; |
| 121 const wchar_t kFoundUwsValueName[] = L"FoundUws"; | 144 const wchar_t kFoundUwsValueName[] = L"FoundUws"; |
| 122 const wchar_t kMemoryUsedValueName[] = L"MemoryUsed"; | 145 const wchar_t kMemoryUsedValueName[] = L"MemoryUsed"; |
| 146 const wchar_t kLogsUploadResultValueName[] = L"LogsUploadResult"; | |
| 123 | 147 |
| 124 const char kFoundUwsMetricName[] = "SoftwareReporter.FoundUwS"; | 148 const char kFoundUwsMetricName[] = "SoftwareReporter.FoundUwS"; |
| 125 const char kFoundUwsReadErrorMetricName[] = | 149 const char kFoundUwsReadErrorMetricName[] = |
| 126 "SoftwareReporter.FoundUwSReadError"; | 150 "SoftwareReporter.FoundUwSReadError"; |
| 127 const char kScanTimesMetricName[] = "SoftwareReporter.UwSScanTimes"; | 151 const char kScanTimesMetricName[] = "SoftwareReporter.UwSScanTimes"; |
| 128 const char kMemoryUsedMetricName[] = "SoftwareReporter.MemoryUsed"; | 152 const char kMemoryUsedMetricName[] = "SoftwareReporter.MemoryUsed"; |
| 153 const char kLogsUploadEnabledMetricName[] = | |
| 154 "SoftwareReporter.LogsUploadEnabled"; | |
| 155 const char kLogsUploadsResultMetricName[] = "SoftwareReporter.LogsUploadResult"; | |
|
grt (UTC plus 2)
2016/09/16 15:59:20
Uploads -> Upload
ftirelo
2016/09/16 19:26:55
Done.
| |
| 129 | 156 |
| 130 // Reports metrics about the software reporter via UMA (and sometimes Rappor). | 157 // Reports metrics about the software reporter via UMA (and sometimes Rappor). |
| 131 class UMAHistogramReporter { | 158 class UMAHistogramReporter { |
| 132 public: | 159 public: |
| 133 UMAHistogramReporter() : UMAHistogramReporter(std::string()) {} | 160 UMAHistogramReporter() : UMAHistogramReporter(std::string()) {} |
| 134 | 161 |
| 135 explicit UMAHistogramReporter(const std::string& suffix) | 162 explicit UMAHistogramReporter(const std::string& suffix) |
| 136 : suffix_(suffix), | 163 : suffix_(suffix), |
| 137 registry_key_(suffix.empty() ? kSoftwareRemovalToolRegistryKey | 164 registry_key_(suffix.empty() ? kSoftwareRemovalToolRegistryKey |
| 138 : base::StringPrintf( | 165 : base::StringPrintf( |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 base::win::RegKey reporter_key(HKEY_CURRENT_USER, registry_key_.c_str(), | 345 base::win::RegKey reporter_key(HKEY_CURRENT_USER, registry_key_.c_str(), |
| 319 KEY_ENUMERATE_SUB_KEYS); | 346 KEY_ENUMERATE_SUB_KEYS); |
| 320 if (reporter_key.Valid()) | 347 if (reporter_key.Valid()) |
| 321 reporter_key.DeleteKey(kScanTimesSubKey); | 348 reporter_key.DeleteKey(kScanTimesSubKey); |
| 322 } | 349 } |
| 323 | 350 |
| 324 void RecordReporterStep(SwReporterUmaValue value) { | 351 void RecordReporterStep(SwReporterUmaValue value) { |
| 325 RecordEnumerationHistogram("SoftwareReporter.Step", value, SW_REPORTER_MAX); | 352 RecordEnumerationHistogram("SoftwareReporter.Step", value, SW_REPORTER_MAX); |
| 326 } | 353 } |
| 327 | 354 |
| 355 void RecordLogsUploadEnabled(SwReporterLogsUploadsEnabled value) { | |
| 356 RecordEnumerationHistogram(kLogsUploadEnabledMetricName, value, | |
| 357 REPORTER_LOGS_UPLOADS_MAX); | |
| 358 } | |
| 359 | |
| 360 void RecordLogsUploadResult() { | |
| 361 base::win::RegKey reporter_key(HKEY_CURRENT_USER, registry_key_.c_str(), | |
| 362 KEY_QUERY_VALUE | KEY_SET_VALUE); | |
|
grt (UTC plus 2)
2016/09/16 15:59:21
combining the RegKey ctor with KEY_SET_VALUE will
ftirelo
2016/09/16 19:26:55
Thanks for the hint! Fixed here and in the other p
| |
| 363 DWORD logs_upload_result = 0; | |
| 364 if (reporter_key.Valid() && | |
| 365 reporter_key.ReadValueDW(kLogsUploadResultValueName, | |
| 366 &logs_upload_result) == ERROR_SUCCESS) { | |
| 367 RecordEnumerationHistogram( | |
| 368 kLogsUploadsResultMetricName, | |
| 369 static_cast<SwReporterLogsUploadsResult>(logs_upload_result), | |
|
grt (UTC plus 2)
2016/09/16 15:59:20
cast this to a Sample rather than the enum since t
ftirelo
2016/09/16 19:26:55
Done.
| |
| 370 REPORTER_LOGS_UPLOADS_RESULT_MAX); | |
| 371 reporter_key.DeleteValue(kLogsUploadResultValueName); | |
| 372 } | |
| 373 } | |
| 374 | |
| 328 private: | 375 private: |
| 329 using Sample = base::HistogramBase::Sample; | 376 using Sample = base::HistogramBase::Sample; |
| 330 | 377 |
| 331 static constexpr base::HistogramBase::Flags kUmaHistogramFlag = | 378 static constexpr base::HistogramBase::Flags kUmaHistogramFlag = |
| 332 base::HistogramBase::kUmaTargetedHistogramFlag; | 379 base::HistogramBase::kUmaTargetedHistogramFlag; |
| 333 | 380 |
| 334 // Helper functions to record histograms with an optional suffix added to the | 381 // Helper functions to record histograms with an optional suffix added to the |
| 335 // histogram name. The UMA_HISTOGRAM macros can't be used because they | 382 // histogram name. The UMA_HISTOGRAM macros can't be used because they |
| 336 // require a constant string. | 383 // require a constant string. |
| 337 | 384 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 if (g_testing_delegate_) | 721 if (g_testing_delegate_) |
| 675 g_testing_delegate_->NotifyLaunchReady(); | 722 g_testing_delegate_->NotifyLaunchReady(); |
| 676 | 723 |
| 677 // Add switches for users who opted into extended Safe Browsing reporting. | 724 // Add switches for users who opted into extended Safe Browsing reporting. |
| 678 // The invocation object is changed locally right before the actual process | 725 // The invocation object is changed locally right before the actual process |
| 679 // is launched because user status can change between this and the next run | 726 // is launched because user status can change between this and the next run |
| 680 // for this ReporterRunner object. For example, the ReporterDone() callback | 727 // for this ReporterRunner object. For example, the ReporterDone() callback |
| 681 // schedules the next run for a few days later, and the user might have | 728 // schedules the next run for a few days later, and the user might have |
| 682 // changed settings in the meantime. | 729 // changed settings in the meantime. |
| 683 PrefService* local_state = g_browser_process->local_state(); | 730 PrefService* local_state = g_browser_process->local_state(); |
| 684 if (next_invocation.flags & SwReporterInvocation::FLAG_SEND_REPORTER_LOGS && | 731 if (next_invocation.supported_behaviours & |
| 732 SwReporterInvocation::REPORTER_BEHAVIOUR_SEND_REPORTER_LOGS && | |
|
grt (UTC plus 2)
2016/09/16 15:59:20
wdyt about moving the enum out of SwReporterInvoca
ftirelo
2016/09/16 19:26:55
Done.
| |
| 685 local_state && ShouldSendReporterLogs(*local_state)) { | 733 local_state && ShouldSendReporterLogs(*local_state)) { |
| 734 next_invocation.logs_upload_enabled = true; | |
| 686 AddSwitchesForExtendedReporterUser(&next_invocation); | 735 AddSwitchesForExtendedReporterUser(&next_invocation); |
| 687 // Set the local state value before the first attempt to run the | 736 // Set the local state value before the first attempt to run the |
| 688 // reporter, because we only want to upload logs once in the window | 737 // reporter, because we only want to upload logs once in the window |
| 689 // defined by |kDaysBetweenReporterLogsSent|. If we set with other local | 738 // defined by |kDaysBetweenReporterLogsSent|. If we set with other local |
| 690 // state values after the reporter runs, we could send logs again too | 739 // state values after the reporter runs, we could send logs again too |
| 691 // quickly (for example, if Chrome stops before the reporter finishes). | 740 // quickly (for example, if Chrome stops before the reporter finishes). |
| 692 local_state->SetInt64(prefs::kSwReporterLastTimeSentReport, | 741 local_state->SetInt64(prefs::kSwReporterLastTimeSentReport, |
| 693 base::Time::Now().ToInternalValue()); | 742 base::Time::Now().ToInternalValue()); |
| 694 } | 743 } |
| 695 | 744 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 | 787 |
| 739 // If the reporter failed to launch, do not process the results. (The exit | 788 // If the reporter failed to launch, do not process the results. (The exit |
| 740 // code itself doesn't need to be logged in this case because | 789 // code itself doesn't need to be logged in this case because |
| 741 // SW_REPORTER_FAILED_TO_START is logged in |LaunchAndWaitForExit|.) | 790 // SW_REPORTER_FAILED_TO_START is logged in |LaunchAndWaitForExit|.) |
| 742 if (exit_code == kReporterFailureExitCode) | 791 if (exit_code == kReporterFailureExitCode) |
| 743 return; | 792 return; |
| 744 | 793 |
| 745 UMAHistogramReporter uma(finished_invocation.suffix); | 794 UMAHistogramReporter uma(finished_invocation.suffix); |
| 746 uma.ReportVersion(version); | 795 uma.ReportVersion(version); |
| 747 uma.ReportExitCode(exit_code); | 796 uma.ReportExitCode(exit_code); |
| 748 uma.ReportFoundUwS(finished_invocation.flags & | 797 uma.ReportFoundUwS(finished_invocation.supported_behaviours & |
| 749 SwReporterInvocation::FLAG_LOG_TO_RAPPOR); | 798 SwReporterInvocation::REPORTER_BEHAVIOUR_LOG_TO_RAPPOR); |
| 750 | 799 |
| 751 PrefService* local_state = g_browser_process->local_state(); | 800 PrefService* local_state = g_browser_process->local_state(); |
| 752 if (local_state) { | 801 if (local_state) { |
| 753 if (finished_invocation.flags & | 802 if (finished_invocation.supported_behaviours & |
| 754 SwReporterInvocation::FLAG_LOG_EXIT_CODE_TO_PREFS) | 803 SwReporterInvocation::REPORTER_BEHAVIOUR_LOG_EXIT_CODE_TO_PREFS) |
| 755 local_state->SetInteger(prefs::kSwReporterLastExitCode, exit_code); | 804 local_state->SetInteger(prefs::kSwReporterLastExitCode, exit_code); |
| 756 local_state->SetInt64(prefs::kSwReporterLastTimeTriggered, | 805 local_state->SetInt64(prefs::kSwReporterLastTimeTriggered, |
| 757 base::Time::Now().ToInternalValue()); | 806 base::Time::Now().ToInternalValue()); |
| 758 } | 807 } |
| 759 uma.ReportRuntime(reporter_running_time); | 808 uma.ReportRuntime(reporter_running_time); |
| 760 uma.ReportScanTimes(); | 809 uma.ReportScanTimes(); |
| 761 uma.ReportMemoryUsage(); | 810 uma.ReportMemoryUsage(); |
| 811 if (finished_invocation.logs_upload_enabled) | |
| 812 uma.RecordLogsUploadResult(); | |
| 762 | 813 |
| 763 if (!(finished_invocation.flags & | 814 if (!(finished_invocation.supported_behaviours & |
| 764 SwReporterInvocation::FLAG_TRIGGER_PROMPT)) | 815 SwReporterInvocation::REPORTER_BEHAVIOUR_TRIGGER_PROMPT)) |
| 765 return; | 816 return; |
| 766 | 817 |
| 767 if (!IsInSRTPromptFieldTrialGroups()) { | 818 if (!IsInSRTPromptFieldTrialGroups()) { |
| 768 // Knowing about disabled field trial is more important than reporter not | 819 // Knowing about disabled field trial is more important than reporter not |
| 769 // finding anything to remove, so check this case first. | 820 // finding anything to remove, so check this case first. |
| 770 RecordReporterStepHistogram(SW_REPORTER_NO_PROMPT_FIELD_TRIAL); | 821 RecordReporterStepHistogram(SW_REPORTER_NO_PROMPT_FIELD_TRIAL); |
| 771 return; | 822 return; |
| 772 } | 823 } |
| 773 | 824 |
| 774 if (exit_code != kSwReporterPostRebootCleanupNeeded && | 825 if (exit_code != kSwReporterPostRebootCleanupNeeded && |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 FROM_HERE, | 884 FROM_HERE, |
| 834 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), | 885 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), |
| 835 next_trigger - now); | 886 next_trigger - now); |
| 836 } | 887 } |
| 837 } | 888 } |
| 838 | 889 |
| 839 // Returns true if the experiment to send reporter logs is enabled, the user | 890 // Returns true if the experiment to send reporter logs is enabled, the user |
| 840 // opted into Safe Browsing extended reporting, and logs have been sent at | 891 // opted into Safe Browsing extended reporting, and logs have been sent at |
| 841 // least |kSwReporterLastTimeSentReport| days ago. | 892 // least |kSwReporterLastTimeSentReport| days ago. |
| 842 bool ShouldSendReporterLogs(const PrefService& local_state) { | 893 bool ShouldSendReporterLogs(const PrefService& local_state) { |
| 843 if (!base::FeatureList::IsEnabled(kSwReporterExtendedSafeBrowsingFeature) || | 894 if (!base::FeatureList::IsEnabled(kSwReporterExtendedSafeBrowsingFeature)) |
| 844 !SafeBrowsingExtendedReportingEnabled()) { | 895 return false; |
| 896 | |
| 897 UMAHistogramReporter uma; | |
| 898 if (!SafeBrowsingExtendedReportingEnabled()) { | |
| 899 uma.RecordLogsUploadEnabled(REPORTER_LOGS_UPLOADS_SBER_DISABLED); | |
| 845 return false; | 900 return false; |
| 846 } | 901 } |
| 847 | 902 |
| 848 const base::Time now = base::Time::Now(); | 903 const base::Time now = base::Time::Now(); |
| 849 const base::Time last_time_sent_logs = base::Time::FromInternalValue( | 904 const base::Time last_time_sent_logs = base::Time::FromInternalValue( |
| 850 local_state.GetInt64(prefs::kSwReporterLastTimeSentReport)); | 905 local_state.GetInt64(prefs::kSwReporterLastTimeSentReport)); |
| 851 // Send the logs if the last send was in the future. This is intended as a | 906 const base::Time next_time_send_logs = |
| 852 // measure for failure recovery, in case the time in local state is | 907 last_time_sent_logs + |
| 853 // incorrectly set to the future. | 908 base::TimeDelta::FromDays(kDaysBetweenReporterLogsSent); |
| 854 if (last_time_sent_logs > now) | 909 // Send the logs if the last send is the future or if the interval has |
| 910 // passed. The former is intended as a measure for failure recovery, in | |
| 911 // case the time in local state is incorrectly set to the future. | |
| 912 if (last_time_sent_logs > now || next_time_send_logs <= now) { | |
| 913 uma.RecordLogsUploadEnabled(REPORTER_LOGS_UPLOADS_ENABLED); | |
| 855 return true; | 914 return true; |
| 856 // Otherwise, send them if the interval has passed. | 915 } |
| 857 return last_time_sent_logs + | 916 uma.RecordLogsUploadEnabled(REPORTER_LOGS_UPLOADS_RECENTLY_SENT_LOGS); |
| 858 base::TimeDelta::FromDays(kDaysBetweenReporterLogsSent) <= | 917 return false; |
| 859 now; | |
| 860 } | 918 } |
| 861 | 919 |
| 862 void AddSwitchesForExtendedReporterUser(SwReporterInvocation* invocation) { | 920 void AddSwitchesForExtendedReporterUser(SwReporterInvocation* invocation) { |
| 863 invocation->command_line.AppendSwitch(kExtendedSafeBrowsingEnabledSwitch); | 921 invocation->command_line.AppendSwitch(kExtendedSafeBrowsingEnabledSwitch); |
| 864 invocation->command_line.AppendSwitchASCII( | 922 invocation->command_line.AppendSwitchASCII( |
| 865 kChromeVersionSwitch, version_info::GetVersionNumber()); | 923 kChromeVersionSwitch, version_info::GetVersionNumber()); |
| 866 invocation->command_line.AppendSwitchNative( | 924 invocation->command_line.AppendSwitchNative( |
| 867 kChromeChannelSwitch, base::IntToString16(ChannelAsInt())); | 925 kChromeChannelSwitch, base::IntToString16(ChannelAsInt())); |
| 868 } | 926 } |
| 869 | 927 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 | 965 |
| 908 SwReporterInvocation SwReporterInvocation::FromCommandLine( | 966 SwReporterInvocation SwReporterInvocation::FromCommandLine( |
| 909 const base::CommandLine& command_line) { | 967 const base::CommandLine& command_line) { |
| 910 SwReporterInvocation invocation; | 968 SwReporterInvocation invocation; |
| 911 invocation.command_line = command_line; | 969 invocation.command_line = command_line; |
| 912 return invocation; | 970 return invocation; |
| 913 } | 971 } |
| 914 | 972 |
| 915 bool SwReporterInvocation::operator==(const SwReporterInvocation& other) const { | 973 bool SwReporterInvocation::operator==(const SwReporterInvocation& other) const { |
| 916 return command_line.argv() == other.command_line.argv() && | 974 return command_line.argv() == other.command_line.argv() && |
| 917 suffix == other.suffix && flags == other.flags; | 975 suffix == other.suffix && |
| 976 supported_behaviours == other.supported_behaviours && | |
| 977 logs_upload_enabled == other.logs_upload_enabled; | |
| 918 } | 978 } |
| 919 | 979 |
| 920 void RunSwReporters(const SwReporterQueue& invocations, | 980 void RunSwReporters(const SwReporterQueue& invocations, |
| 921 const base::Version& version, | 981 const base::Version& version, |
| 922 scoped_refptr<base::TaskRunner> main_thread_task_runner, | 982 scoped_refptr<base::TaskRunner> main_thread_task_runner, |
| 923 scoped_refptr<base::TaskRunner> blocking_task_runner) { | 983 scoped_refptr<base::TaskRunner> blocking_task_runner) { |
| 924 DCHECK(!invocations.empty()); | 984 DCHECK(!invocations.empty()); |
| 925 DCHECK(version.IsValid()); | 985 DCHECK(version.IsValid()); |
| 926 ReporterRunner::ScheduleInvocations(invocations, version, | 986 ReporterRunner::ScheduleInvocations(invocations, version, |
| 927 std::move(main_thread_task_runner), | 987 std::move(main_thread_task_runner), |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 944 KEY_QUERY_VALUE); | 1004 KEY_QUERY_VALUE); |
| 945 | 1005 |
| 946 return srt_cleaner_key.Valid() && srt_cleaner_key.GetValueCount() > 0; | 1006 return srt_cleaner_key.Valid() && srt_cleaner_key.GetValueCount() > 0; |
| 947 } | 1007 } |
| 948 | 1008 |
| 949 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { | 1009 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { |
| 950 g_testing_delegate_ = delegate; | 1010 g_testing_delegate_ = delegate; |
| 951 } | 1011 } |
| 952 | 1012 |
| 953 } // namespace safe_browsing | 1013 } // namespace safe_browsing |
| OLD | NEW |