OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN_H_ | |
6 #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN_H_ | |
7 | |
8 #include <limits> | |
9 #include <memory> | |
10 #include <set> | |
11 #include <string> | |
12 | |
13 #include "base/callback.h" | |
14 #include "base/command_line.h" | |
15 #include "base/files/file_path.h" | |
16 #include "base/memory/ref_counted.h" | |
17 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h" | |
18 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" | |
19 | |
20 namespace safe_browsing { | |
21 | |
22 void RunChromeCleanerAndReplyWithExitCode( | |
ftirelo
2017/05/18 18:27:51
Since we need to forward some switches from the re
alito
2017/05/18 23:01:17
Done.
| |
23 const base::FilePath& executable_path, | |
24 bool metrics_enabled, | |
25 bool sber_enabled, | |
ftirelo
2017/05/18 18:27:51
As discussed, this is only used today for logging
alito
2017/05/18 23:01:17
Done. Also renamed the variable to cleaner_logs_en
| |
26 ChromePromptImpl::OnPromptUserCallback on_prompt_user, | |
27 base::OnceClosure on_connection_closed, | |
28 base::OnceClosure on_connection_error, | |
29 base::Callback<void(int /*exit code*/)> done_callback); | |
30 | |
31 class ChromeCleanerRunner | |
ftirelo
2017/05/18 18:27:51
Please document lifetime for this object.
alito
2017/05/18 23:01:17
Done. Added a bunch of documentation.
| |
32 : public base::RefCountedThreadSafe<ChromeCleanerRunner> { | |
33 public: | |
34 static constexpr int kNotLaunchedExitCode = std::numeric_limits<int>::max(); | |
35 | |
36 ChromeCleanerRunner(const base::FilePath& executable_path, | |
37 bool metrics_enabled, | |
38 bool sber_enabled, | |
39 ChromePromptImpl::OnPromptUserCallback on_prompt_user, | |
40 base::OnceClosure on_connection_closed, | |
41 base::OnceClosure on_connection_error); | |
42 | |
43 int LaunchAndWaitForExitOnBackgroundThread(); | |
44 | |
45 private: | |
46 friend class base::RefCountedThreadSafe<ChromeCleanerRunner>; | |
47 ~ChromeCleanerRunner(); | |
48 | |
49 void CreateChromePromptImpl( | |
50 chrome_cleaner::mojom::ChromePromptRequest chrome_prompt_request); | |
51 void ReleaseChromePromptImpl(); | |
52 | |
53 void OnPromptUser(std::unique_ptr<std::set<base::FilePath>> files_to_delete, | |
54 chrome_cleaner::mojom::ChromePrompt::PromptUserCallback | |
55 prompt_user_callback); | |
56 void OnConnectionClosed(); | |
57 void OnConnectionError(const std::string& error); | |
58 | |
59 base::CommandLine command_line_; | |
60 ChromePromptImpl::OnPromptUserCallback on_prompt_user_; | |
61 base::OnceClosure on_connection_closed_; | |
62 base::OnceClosure on_connection_error_; | |
63 | |
64 std::unique_ptr<ChromePromptImpl> chrome_prompt_impl_; | |
65 }; | |
66 | |
67 } // namespace safe_browsing | |
68 | |
69 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN _H_ | |
OLD | NEW |