| 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ |
| 7 | 7 |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/feature_list.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/version.h" | 16 #include "base/version.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class FilePath; | 19 class FilePath; |
| 19 class TaskRunner; | 20 class TaskRunner; |
| 20 } | 21 } |
| 21 | 22 |
| 22 class Browser; | 23 class Browser; |
| 23 | 24 |
| 24 namespace safe_browsing { | 25 namespace safe_browsing { |
| 25 | 26 |
| 26 // SRT registry keys and value names. | 27 // SRT registry keys and value names. |
| 27 extern const wchar_t kSoftwareRemovalToolRegistryKey[]; | 28 extern const wchar_t kSoftwareRemovalToolRegistryKey[]; |
| 28 extern const wchar_t kEndTimeValueName[]; | 29 extern const wchar_t kEndTimeValueName[]; |
| 29 extern const wchar_t kStartTimeValueName[]; | 30 extern const wchar_t kStartTimeValueName[]; |
| 30 | 31 |
| 31 // Reporter exit codes. | 32 // Reporter exit codes. |
| 32 const int kSwReporterCleanupNeeded = 0; | 33 const int kSwReporterCleanupNeeded = 0; |
| 33 const int kSwReporterNothingFound = 2; | 34 const int kSwReporterNothingFound = 2; |
| 34 const int kSwReporterPostRebootCleanupNeeded = 4; | 35 const int kSwReporterPostRebootCleanupNeeded = 4; |
| 35 const int kSwReporterDelayedPostRebootCleanupNeeded = 15; | 36 const int kSwReporterDelayedPostRebootCleanupNeeded = 15; |
| 36 | 37 |
| 37 // A special exit code identifying a failure to run the reporter. | 38 // A special exit code identifying a failure to run the reporter. |
| 38 const int kReporterFailureExitCode = INT_MAX; | 39 const int kReporterFailureExitCode = INT_MAX; |
| 39 | 40 |
| 40 // The number of days to wait before triggering another reporter run. | 41 // The number of days to wait before triggering another reporter run. |
| 41 const int kDaysBetweenSuccessfulSwReporterRuns = 7; | 42 const int kDaysBetweenSuccessfulSwReporterRuns = 7; |
| 42 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1; | 43 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1; |
| 44 // The number of days to wait before sending out reporter logs. |
| 45 const int kDaysBetweenReporterLogsSent = 7; |
| 46 |
| 47 extern const char kExtendedSafeBrowsingEnabledSwitch[]; |
| 48 |
| 49 extern const base::Feature kSwReporterExtendedSafeBrowsingFeature; |
| 43 | 50 |
| 44 // Parameters used to invoke the sw_reporter component. | 51 // Parameters used to invoke the sw_reporter component. |
| 45 struct SwReporterInvocation { | 52 struct SwReporterInvocation { |
| 46 base::CommandLine command_line; | 53 base::CommandLine command_line; |
| 47 | 54 |
| 48 // Experimental versions of the reporter will write metrics to registry keys | 55 // Experimental versions of the reporter will write metrics to registry keys |
| 49 // ending in |suffix|. Those metrics should be copied to UMA histograms also | 56 // ending in |suffix|. Those metrics should be copied to UMA histograms also |
| 50 // ending in |suffix|. For the canonical version, |suffix| will be empty. | 57 // ending in |suffix|. For the canonical version, |suffix| will be empty. |
| 51 std::string suffix; | 58 std::string suffix; |
| 52 | 59 |
| 53 // The experimental sw_reporter never triggers the prompt, just reports | 60 // The experimental sw_reporter never triggers the prompt, just reports |
| 54 // results through UMA. | 61 // results through UMA. |
| 55 bool is_experimental = false; | 62 bool is_experimental = false; |
| 56 | 63 |
| 57 SwReporterInvocation(); | 64 SwReporterInvocation(); |
| 65 SwReporterInvocation(const SwReporterInvocation& other); |
| 58 | 66 |
| 59 static SwReporterInvocation FromFilePath(const base::FilePath& exe_path); | 67 static SwReporterInvocation FromFilePath(const base::FilePath& exe_path); |
| 60 static SwReporterInvocation FromCommandLine( | 68 static SwReporterInvocation FromCommandLine( |
| 61 const base::CommandLine& command_line); | 69 const base::CommandLine& command_line); |
| 62 | 70 |
| 63 bool operator==(const SwReporterInvocation& other) const; | 71 bool operator==(const SwReporterInvocation& other) const; |
| 64 }; | 72 }; |
| 65 | 73 |
| 66 // Tries to run the sw_reporter component, and then schedule the next try. If | 74 // Tries to run the sw_reporter component, and then schedule the next try. If |
| 67 // called multiple times, then multiple sequences of trying to run will happen, | 75 // called multiple times, then multiple sequences of trying to run will happen, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 116 |
| 109 // Set a delegate for testing. The implementation will not take ownership of | 117 // Set a delegate for testing. The implementation will not take ownership of |
| 110 // |delegate| - it must remain valid until this function is called again to | 118 // |delegate| - it must remain valid until this function is called again to |
| 111 // reset the delegate. If |delegate| is nullptr, any previous delegate is | 119 // reset the delegate. If |delegate| is nullptr, any previous delegate is |
| 112 // cleared. | 120 // cleared. |
| 113 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate); | 121 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate); |
| 114 | 122 |
| 115 } // namespace safe_browsing | 123 } // namespace safe_browsing |
| 116 | 124 |
| 117 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ | 125 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ |
| OLD | NEW |