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_SRT_CHROME_PROMPT_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SRT_CHROME_PROMPT_IMPL_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SRT_CHROME_PROMPT_IMPL_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SRT_CHROME_PROMPT_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" | 15 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" |
16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
17 | 17 |
18 namespace safe_browsing { | 18 namespace safe_browsing { |
19 | 19 |
20 // Implementation of the ChromePrompt Mojo interface. | 20 // Implementation of the ChromePrompt Mojo interface. Must be constructed and |
| 21 // destructed on the IO thread. |
21 class ChromePromptImpl : public chrome_cleaner::mojom::ChromePrompt { | 22 class ChromePromptImpl : public chrome_cleaner::mojom::ChromePrompt { |
22 public: | 23 public: |
23 using OnPromptUser = base::OnceCallback<void( | 24 using OnPromptUser = base::OnceCallback<void( |
24 std::unique_ptr<std::set<base::FilePath>>, | 25 std::unique_ptr<std::set<base::FilePath>>, |
25 chrome_cleaner::mojom::ChromePrompt::PromptUserCallback)>; | 26 chrome_cleaner::mojom::ChromePrompt::PromptUserCallback)>; |
26 | 27 |
27 ChromePromptImpl(chrome_cleaner::mojom::ChromePromptRequest request, | 28 ChromePromptImpl(chrome_cleaner::mojom::ChromePromptRequest request, |
28 base::Closure on_connection_closed, | 29 base::Closure on_connection_closed, |
29 OnPromptUser on_prompt_user); | 30 OnPromptUser on_prompt_user); |
30 ~ChromePromptImpl() override; | 31 ~ChromePromptImpl() override; |
31 | 32 |
32 void PromptUser( | 33 void PromptUser( |
33 std::vector<chrome_cleaner::mojom::UwSPtr> removable_uws_found, | 34 std::vector<chrome_cleaner::mojom::UwSPtr> removable_uws_found, |
34 chrome_cleaner::mojom::ElevationStatus elevation_status, | 35 chrome_cleaner::mojom::ElevationStatus elevation_status, |
35 chrome_cleaner::mojom::ChromePrompt::PromptUserCallback callback) | 36 chrome_cleaner::mojom::ChromePrompt::PromptUserCallback callback) |
36 override; | 37 override; |
37 | 38 |
38 private: | 39 private: |
39 mojo::Binding<chrome_cleaner::mojom::ChromePrompt> binding_; | 40 mojo::Binding<chrome_cleaner::mojom::ChromePrompt> binding_; |
40 OnPromptUser on_prompt_user_; | 41 OnPromptUser on_prompt_user_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(ChromePromptImpl); | 43 DISALLOW_COPY_AND_ASSIGN(ChromePromptImpl); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace safe_browsing | 46 } // namespace safe_browsing |
46 | 47 |
47 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SRT_CHROME_PROMPT_IMPL_H_ | 48 #endif // CHROME_BROWSER_SAFE_BROWSING_CHROME_CLEANER_SRT_CHROME_PROMPT_IMPL_H_ |
OLD | NEW |