Chromium Code Reviews| 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_SRT_CHROME_PROMPT_IMPL_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_CHROME_PROMPT_IMPL_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_CHROME_PROMPT_IMPL_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_CHROME_PROMPT_IMPL_H_ |
| 7 | 7 |
| 8 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" | 8 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" | 9 #include "mojo/public/cpp/bindings/binding.h" |
| 10 | 10 |
| 11 namespace safe_browsing { | 11 namespace safe_browsing { |
| 12 | 12 |
| 13 // Implementation of the ChromePrompt Mojo interface. | 13 // Implementation of the ChromePrompt Mojo interface. |
| 14 class ChromePromptImpl : public chrome_cleaner::mojom::ChromePrompt { | 14 class ChromePromptImpl : public chrome_cleaner::mojom::ChromePrompt { |
| 15 public: | 15 public: |
| 16 // Implements specific mocking actions for tests. | |
|
grt (UTC plus 2)
2017/04/21 11:10:58
this is an interface for such, not an implementati
ftirelo
2017/04/24 15:47:45
Done.
| |
| 17 class TestDelegate { | |
| 18 public: | |
| 19 virtual void OnPromptUser() = 0; | |
| 20 virtual void OnConnectionError() = 0; | |
| 21 }; | |
| 22 | |
| 16 explicit ChromePromptImpl(chrome_cleaner::mojom::ChromePromptRequest request); | 23 explicit ChromePromptImpl(chrome_cleaner::mojom::ChromePromptRequest request); |
| 17 ~ChromePromptImpl() override; | 24 ~ChromePromptImpl() override; |
| 18 | 25 |
| 19 void PromptUser( | 26 void PromptUser( |
| 20 std::vector<chrome_cleaner::mojom::UwSPtr> removable_uws_found, | 27 std::vector<chrome_cleaner::mojom::UwSPtr> removable_uws_found, |
| 21 chrome_cleaner::mojom::ElevationStatus elevation_status, | 28 chrome_cleaner::mojom::ElevationStatus elevation_status, |
| 22 const chrome_cleaner::mojom::ChromePrompt::PromptUserCallback& callback) | 29 const chrome_cleaner::mojom::ChromePrompt::PromptUserCallback& callback) |
| 23 override; | 30 override; |
| 24 | 31 |
| 32 // Handles the case when the remote end has been closed, by performing the | |
| 33 // necessary cleanups if the prompt dialog is being shown to the user. | |
| 34 void OnConnectionClosed(); | |
| 35 | |
| 36 // Handles the case when a mojo::ReportBadMessage has been explicitely | |
| 37 // reported. | |
| 38 void OnConnectionError(const std::string& message); | |
| 39 | |
| 40 static void SetTestDelegate(TestDelegate* test_delegate); | |
| 41 | |
| 25 private: | 42 private: |
| 26 mojo::Binding<chrome_cleaner::mojom::ChromePrompt> binding_; | 43 mojo::Binding<chrome_cleaner::mojom::ChromePrompt> binding_; |
| 44 static TestDelegate* test_delegate_; | |
|
grt (UTC plus 2)
2017/04/21 11:10:58
is it possible to inject the delegate without usin
ftirelo
2017/04/24 15:47:45
Good idea. Changed as suggested in srt_fetcher_win
| |
| 27 }; | 45 }; |
|
grt (UTC plus 2)
2017/04/21 11:10:58
DISALLOW_COPY_AND_ASSIGN?
ftirelo
2017/04/24 15:47:45
Done.
| |
| 28 | 46 |
| 29 } // namespace safe_browsing | 47 } // namespace safe_browsing |
| 30 | 48 |
| 31 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_CHROME_PROMPT_IMPL_H_ | 49 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_CHROME_PROMPT_IMPL_H_ |
| OLD | NEW |