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

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.h

Issue 2890023005: Chrome Cleaner UI: reporter no longer uses mojo. (Closed)
Patch Set: Rip out the mojo code from the reporter runner. Created 3 years, 7 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_REPORTER_RUNNER_WIN_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_REPORTER_RUNNER_WIN_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_REPORTER_RUNNER_WIN_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_REPORTER_RUNNER_WIN_H_
7 7
8 #include <limits.h> 8 #include <limits.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <queue> 12 #include <queue>
13 #include <string> 13 #include <string>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/feature_list.h" 16 #include "base/feature_list.h"
17 #include "base/process/launch.h"
18 #include "base/process/process.h"
19 #include "base/time/time.h" 17 #include "base/time/time.h"
20 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h"
21 18
22 namespace base { 19 namespace base {
23 class FilePath; 20 class FilePath;
24 class TaskRunner; 21 class TaskRunner;
25 class Version; 22 class Version;
26 } 23 }
27 24
28 class Browser; 25 class Browser;
29 26
30 namespace safe_browsing { 27 namespace safe_browsing {
31 28
32 class ChromePromptImpl;
33
34 // A special exit code identifying a failure to run the reporter. 29 // A special exit code identifying a failure to run the reporter.
35 const int kReporterNotLaunchedExitCode = INT_MAX; 30 const int kReporterNotLaunchedExitCode = INT_MAX;
36 31
37 // The number of days to wait before triggering another reporter run. 32 // The number of days to wait before triggering another reporter run.
38 const int kDaysBetweenSuccessfulSwReporterRuns = 7; 33 const int kDaysBetweenSuccessfulSwReporterRuns = 7;
39 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1; 34 const int kDaysBetweenSwReporterRunsForPendingPrompt = 1;
40 // The number of days to wait before sending out reporter logs. 35 // The number of days to wait before sending out reporter logs.
41 const int kDaysBetweenReporterLogsSent = 7; 36 const int kDaysBetweenReporterLogsSent = 7;
42 37
43 // When enabled, moves all user interaction with the Software Reporter and the 38 // When enabled, moves all user interaction with the Software Reporter and the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // TODO(tmartino): Consider changing to check whether the user has recently 101 // 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. 102 // run the cleaner, rather than checking if they've run it at all.
108 bool UserHasRunCleaner(); 103 bool UserHasRunCleaner();
109 104
110 // A delegate used by tests to implement test doubles (e.g., stubs, fakes, or 105 // A delegate used by tests to implement test doubles (e.g., stubs, fakes, or
111 // mocks). 106 // mocks).
112 class SwReporterTestingDelegate { 107 class SwReporterTestingDelegate {
113 public: 108 public:
114 virtual ~SwReporterTestingDelegate() {} 109 virtual ~SwReporterTestingDelegate() {}
115 110
116 // Invoked by tests in places of base::LaunchProcess. 111 // Invoked by tests in place of base::LaunchProcess.
117 // See chrome_cleaner::mojom::ChromePromptRequest(). 112 virtual int LaunchReporter(const SwReporterInvocation& invocation) = 0;
118 virtual base::Process LaunchReporter(
119 const SwReporterInvocation& invocation,
120 const base::LaunchOptions& launch_options) = 0;
121 113
122 // Invoked by tests in place of the actual prompting logic. 114 // Invoked by tests in place of the actual prompting logic.
123 // See MaybeFetchSRT(). 115 // See MaybeFetchSRT().
124 virtual void TriggerPrompt(Browser* browser, 116 virtual void TriggerPrompt(Browser* browser,
125 const std::string& reporter_version) = 0; 117 const std::string& reporter_version) = 0;
126 118
127 // Invoked by tests to override the current time. 119 // Invoked by tests to override the current time.
128 // See Now() in reporter_runner_win.cc. 120 // See Now() in reporter_runner_win.cc.
129 virtual base::Time Now() const = 0; 121 virtual base::Time Now() const = 0;
130 122
131 // A task runner used to spawn the reporter process (which blocks). 123 // A task runner used to spawn the reporter process (which blocks).
132 // See ReporterRunner::ScheduleNextInvocation(). 124 // See ReporterRunner::ScheduleNextInvocation().
133 virtual base::TaskRunner* BlockingTaskRunner() const = 0; 125 virtual base::TaskRunner* BlockingTaskRunner() const = 0;
134
135 // Returns a ChromePromptImpl object that keeps track of specific
136 // actions during tests. Replaces the object returned by
137 // SwReporterProcess::CreateChromePromptImpl().
138 // See SwReporterProcess::LaunchConnectedReporterProcess().
139 virtual std::unique_ptr<ChromePromptImpl> CreateChromePromptImpl(
140 chrome_cleaner::mojom::ChromePromptRequest request) = 0;
141
142 // Connection closed callback defined by tests in place of the default
143 // error handler. See ReporterRunnerTest::CreateChromePromptImpl().
144 virtual void OnConnectionClosed() = 0;
145
146 // Bad message handler callback defined by tests in place of the default
147 // error handler. See SwReporterProcess::LaunchConnectedReporterProcess().
148 virtual void OnConnectionError(const std::string& message) = 0;
149 }; 126 };
150 127
151 // Set a delegate for testing. The implementation will not take ownership of 128 // Set a delegate for testing. The implementation will not take ownership of
152 // |delegate| - it must remain valid until this function is called again to 129 // |delegate| - it must remain valid until this function is called again to
153 // reset the delegate. If |delegate| is nullptr, any previous delegate is 130 // reset the delegate. If |delegate| is nullptr, any previous delegate is
154 // cleared. 131 // cleared.
155 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate); 132 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate);
156 133
157 void DisplaySRTPromptForTesting(const base::FilePath& download_path); 134 void DisplaySRTPromptForTesting(const base::FilePath& download_path);
158 135
159 } // namespace safe_browsing 136 } // namespace safe_browsing
160 137
161 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_REPORTER_RUNNER_WIN_H_ 138 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_REPORTER_RUNNER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698