| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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_CHROME_CLEANER_RUNNER_WIN_H_ | 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_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/process/launch.h" | 17 #include "base/process/launch.h" |
| 18 #include "base/process/process.h" | 18 #include "base/process/process.h" |
| 19 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
| 20 #include "chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.h" | 20 #include "chrome/browser/safe_browsing/chrome_cleaner/reporter_runner_win.h" |
| 21 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h" | 21 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h" |
| 22 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" | 22 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" |
| 23 #include "content/public/browser/browser_thread.h" |
| 23 | 24 |
| 24 namespace safe_browsing { | 25 namespace safe_browsing { |
| 25 | 26 |
| 26 // Class responsible for launching the cleaner process and waiting for its | 27 // Class responsible for launching the cleaner process and waiting for its |
| 27 // completion when the InBrowserCleanerUI feature is enabled. This object is | 28 // completion when the InBrowserCleanerUI feature is enabled. This object is |
| 28 // also responsible for starting the ChromePromptImpl object on the IO thread | 29 // also responsible for starting the ChromePromptImpl object on the IO thread |
| 29 // and controlling its lifetime. | 30 // and controlling its lifetime. |
| 30 // | 31 // |
| 31 // Expected lifecycle of a ChromeCleanerRunner: | 32 // Expected lifecycle of a ChromeCleanerRunner: |
| 32 // | 33 // |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void OnConnectionClosed(); | 125 void OnConnectionClosed(); |
| 125 void OnProcessDone(LaunchStatus launch_status); | 126 void OnProcessDone(LaunchStatus launch_status); |
| 126 | 127 |
| 127 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 128 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 128 | 129 |
| 129 base::CommandLine cleaner_command_line_; | 130 base::CommandLine cleaner_command_line_; |
| 130 ChromePromptImpl::OnPromptUser on_prompt_user_; | 131 ChromePromptImpl::OnPromptUser on_prompt_user_; |
| 131 base::OnceClosure on_connection_closed_; | 132 base::OnceClosure on_connection_closed_; |
| 132 ProcessDoneCallback on_process_done_; | 133 ProcessDoneCallback on_process_done_; |
| 133 | 134 |
| 134 std::unique_ptr<ChromePromptImpl> chrome_prompt_impl_; | 135 std::unique_ptr<ChromePromptImpl, content::BrowserThread::DeleteOnIOThread> |
| 136 chrome_prompt_impl_; |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 // A delegate class used to override launching of the Cleaner proccess for | 139 // A delegate class used to override launching of the Cleaner proccess for |
| 138 // tests. | 140 // tests. |
| 139 class ChromeCleanerRunnerTestDelegate { | 141 class ChromeCleanerRunnerTestDelegate { |
| 140 public: | 142 public: |
| 141 virtual ~ChromeCleanerRunnerTestDelegate() = default; | 143 virtual ~ChromeCleanerRunnerTestDelegate() = default; |
| 142 | 144 |
| 143 // Called instead of base::LaunchProcess() during testing. | 145 // Called instead of base::LaunchProcess() during testing. |
| 144 virtual base::Process LaunchTestProcess( | 146 virtual base::Process LaunchTestProcess( |
| 145 const base::CommandLine& command_line, | 147 const base::CommandLine& command_line, |
| 146 const base::LaunchOptions& launch_options) = 0; | 148 const base::LaunchOptions& launch_options) = 0; |
| 147 }; | 149 }; |
| 148 | 150 |
| 149 void SetChromeCleanerRunnerTestDelegateForTesting( | 151 void SetChromeCleanerRunnerTestDelegateForTesting( |
| 150 ChromeCleanerRunnerTestDelegate* test_delegate); | 152 ChromeCleanerRunnerTestDelegate* test_delegate); |
| 151 | 153 |
| 152 } // namespace safe_browsing | 154 } // namespace safe_browsing |
| 153 | 155 |
| 154 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN
_H_ | 156 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_CHROME_CLEANER_RUNNER_WIN
_H_ |
| OLD | NEW |