Chromium Code Reviews| Index: chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h |
| diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..327c0eb81c2c3d6822260467352cb4a5ea77dc0e |
| --- /dev/null |
| +++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h |
| @@ -0,0 +1,69 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN_H_ |
| +#define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN_H_ |
| + |
| +#include <limits> |
| +#include <memory> |
| +#include <set> |
| +#include <string> |
| + |
| +#include "base/callback.h" |
| +#include "base/command_line.h" |
| +#include "base/files/file_path.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h" |
| +#include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" |
| + |
| +namespace safe_browsing { |
| + |
| +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.
|
| + const base::FilePath& executable_path, |
| + bool metrics_enabled, |
| + 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
|
| + ChromePromptImpl::OnPromptUserCallback on_prompt_user, |
| + base::OnceClosure on_connection_closed, |
| + base::OnceClosure on_connection_error, |
| + base::Callback<void(int /*exit code*/)> done_callback); |
| + |
| +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.
|
| + : public base::RefCountedThreadSafe<ChromeCleanerRunner> { |
| + public: |
| + static constexpr int kNotLaunchedExitCode = std::numeric_limits<int>::max(); |
| + |
| + ChromeCleanerRunner(const base::FilePath& executable_path, |
| + bool metrics_enabled, |
| + bool sber_enabled, |
| + ChromePromptImpl::OnPromptUserCallback on_prompt_user, |
| + base::OnceClosure on_connection_closed, |
| + base::OnceClosure on_connection_error); |
| + |
| + int LaunchAndWaitForExitOnBackgroundThread(); |
| + |
| + private: |
| + friend class base::RefCountedThreadSafe<ChromeCleanerRunner>; |
| + ~ChromeCleanerRunner(); |
| + |
| + void CreateChromePromptImpl( |
| + chrome_cleaner::mojom::ChromePromptRequest chrome_prompt_request); |
| + void ReleaseChromePromptImpl(); |
| + |
| + void OnPromptUser(std::unique_ptr<std::set<base::FilePath>> files_to_delete, |
| + chrome_cleaner::mojom::ChromePrompt::PromptUserCallback |
| + prompt_user_callback); |
| + void OnConnectionClosed(); |
| + void OnConnectionError(const std::string& error); |
| + |
| + base::CommandLine command_line_; |
| + ChromePromptImpl::OnPromptUserCallback on_prompt_user_; |
| + base::OnceClosure on_connection_closed_; |
| + base::OnceClosure on_connection_error_; |
| + |
| + std::unique_ptr<ChromePromptImpl> chrome_prompt_impl_; |
| +}; |
| + |
| +} // namespace safe_browsing |
| + |
| +#endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN_H_ |