| 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 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/feature_list.h" |
| 16 #include "base/process/launch.h" |
| 17 #include "base/process/process.h" |
| 15 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 16 | 19 |
| 17 namespace base { | 20 namespace base { |
| 18 class FilePath; | 21 class FilePath; |
| 19 class TaskRunner; | 22 class TaskRunner; |
| 20 class Version; | 23 class Version; |
| 21 } | 24 } |
| 22 | 25 |
| 23 class Browser; | 26 class Browser; |
| 24 | 27 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 | 40 |
| 38 // A special exit code identifying a failure to run the reporter. | 41 // A special exit code identifying a failure to run the reporter. |
| 39 const int kReporterFailureExitCode = INT_MAX; | 42 const int kReporterFailureExitCode = INT_MAX; |
| 40 | 43 |
| 41 // The number of days to wait before triggering another reporter run. | 44 // The number of days to wait before triggering another reporter run. |
| 42 const int kDaysBetweenSuccessfulSwReporterRuns = 7; | 45 const int kDaysBetweenSuccessfulSwReporterRuns = 7; |
| 43 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1; | 46 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1; |
| 44 // The number of days to wait before sending out reporter logs. | 47 // The number of days to wait before sending out reporter logs. |
| 45 const int kDaysBetweenReporterLogsSent = 7; | 48 const int kDaysBetweenReporterLogsSent = 7; |
| 46 | 49 |
| 50 // When enabled, moves all user interaction with the Software Reporter and the |
| 51 // Chrome Cleanup tool to Chrome. |
| 52 extern const base::Feature kInBrowserCleanerUIFeature; |
| 53 |
| 54 // The switch to be passed to the Software Reporter process with the Mojo pipe |
| 55 // token for the IPC communication with Chrome. |
| 56 // TODO(crbug/709035) Move this to //components/chrome_cleaner. |
| 57 extern const char kChromeMojoPipeTokenSwitch[]; |
| 58 |
| 47 // Parameters used to invoke the sw_reporter component. | 59 // Parameters used to invoke the sw_reporter component. |
| 48 struct SwReporterInvocation { | 60 struct SwReporterInvocation { |
| 49 base::CommandLine command_line; | 61 base::CommandLine command_line; |
| 50 | 62 |
| 51 // Experimental versions of the reporter will write metrics to registry keys | 63 // Experimental versions of the reporter will write metrics to registry keys |
| 52 // ending in |suffix|. Those metrics should be copied to UMA histograms also | 64 // ending in |suffix|. Those metrics should be copied to UMA histograms also |
| 53 // ending in |suffix|. For the canonical version, |suffix| will be empty. | 65 // ending in |suffix|. For the canonical version, |suffix| will be empty. |
| 54 std::string suffix; | 66 std::string suffix; |
| 55 | 67 |
| 56 // Flags to control behaviours the Software Reporter should support by | 68 // Flags to control behaviours the Software Reporter should support by |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // TODO(tmartino): Consider changing to check whether the user has recently | 118 // TODO(tmartino): Consider changing to check whether the user has recently |
| 107 // run the cleaner, rather than checking if they've run it at all. | 119 // run the cleaner, rather than checking if they've run it at all. |
| 108 bool UserHasRunCleaner(); | 120 bool UserHasRunCleaner(); |
| 109 | 121 |
| 110 // Mocks and callbacks for the unit tests. | 122 // Mocks and callbacks for the unit tests. |
| 111 class SwReporterTestingDelegate { | 123 class SwReporterTestingDelegate { |
| 112 public: | 124 public: |
| 113 virtual ~SwReporterTestingDelegate() {} | 125 virtual ~SwReporterTestingDelegate() {} |
| 114 | 126 |
| 115 // Test mock for launching the reporter. | 127 // Test mock for launching the reporter. |
| 116 virtual int LaunchReporter(const SwReporterInvocation& invocation) = 0; | 128 virtual base::Process LaunchReporter( |
| 129 const SwReporterInvocation& invocation, |
| 130 const base::LaunchOptions& launch_options) = 0; |
| 117 | 131 |
| 118 // Test mock for showing the prompt. | 132 // Test mock for showing the prompt. |
| 119 virtual void TriggerPrompt(Browser* browser, | 133 virtual void TriggerPrompt(Browser* browser, |
| 120 const std::string& reporter_version) = 0; | 134 const std::string& reporter_version) = 0; |
| 121 | 135 |
| 122 // Returns the test's idea of the current time. | 136 // Returns the test's idea of the current time. |
| 123 virtual base::Time Now() const = 0; | 137 virtual base::Time Now() const = 0; |
| 124 | 138 |
| 125 // A task runner used to spawn the reporter process (which blocks). | 139 // A task runner used to spawn the reporter process (which blocks). |
| 126 virtual base::TaskRunner* BlockingTaskRunner() const = 0; | 140 virtual base::TaskRunner* BlockingTaskRunner() const = 0; |
| 127 }; | 141 }; |
| 128 | 142 |
| 129 // Set a delegate for testing. The implementation will not take ownership of | 143 // Set a delegate for testing. The implementation will not take ownership of |
| 130 // |delegate| - it must remain valid until this function is called again to | 144 // |delegate| - it must remain valid until this function is called again to |
| 131 // reset the delegate. If |delegate| is nullptr, any previous delegate is | 145 // reset the delegate. If |delegate| is nullptr, any previous delegate is |
| 132 // cleared. | 146 // cleared. |
| 133 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate); | 147 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate); |
| 134 | 148 |
| 135 void DisplaySRTPromptForTesting(const base::FilePath& download_path); | 149 void DisplaySRTPromptForTesting(const base::FilePath& download_path); |
| 136 | 150 |
| 137 } // namespace safe_browsing | 151 } // namespace safe_browsing |
| 138 | 152 |
| 139 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ | 153 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_FETCHER_WIN_H_ |
| OLD | NEW |