Chromium Code Reviews| Index: chrome/browser/safe_browsing/srt_chrome_prompt_impl.cc |
| diff --git a/chrome/browser/safe_browsing/srt_chrome_prompt_impl.cc b/chrome/browser/safe_browsing/srt_chrome_prompt_impl.cc |
| index 38bb6015efc851f563ca2bece0c69110a7fda174..98c5ad52a79a09aaaf2eb8a4d19e4cce994da4a6 100644 |
| --- a/chrome/browser/safe_browsing/srt_chrome_prompt_impl.cc |
| +++ b/chrome/browser/safe_browsing/srt_chrome_prompt_impl.cc |
| @@ -15,7 +15,10 @@ using chrome_cleaner::mojom::PromptAcceptance; |
| using chrome_cleaner::mojom::UwSPtr; |
| ChromePromptImpl::ChromePromptImpl(ChromePromptRequest request) |
| - : binding_(this, std::move(request)) {} |
| + : binding_(this, std::move(request)) { |
| + binding_.set_connection_error_handler(base::Bind( |
| + &ChromePromptImpl::OnConnectionClosed, base::Unretained(this))); |
|
grt (UTC plus 2)
2017/04/21 11:10:58
please document why Unretained is safe
ftirelo
2017/04/24 15:47:45
Obsolete.
|
| +} |
| ChromePromptImpl::~ChromePromptImpl() {} |
| @@ -23,9 +26,35 @@ void ChromePromptImpl::PromptUser( |
| std::vector<UwSPtr> removable_uws_found, |
| ElevationStatus elevation_status, |
| const ChromePrompt::PromptUserCallback& callback) { |
| + if (test_delegate_) |
| + test_delegate_->OnPromptUser(); |
| + |
| // Placeholder. The actual implementation will show the prompt dialog to the |
| // user and invoke this callback depending on the user's response. |
| callback.Run(PromptAcceptance::DENIED); |
| } |
| +void ChromePromptImpl::OnConnectionClosed() { |
| + // Placeholder. This should handle cases when the reporter process is |
| + // disconnected (e.g. due to a crash) and the prompt dialog is being shown |
| + // to the user. |
| +} |
| + |
| +void ChromePromptImpl::OnConnectionError(const std::string& message) { |
| + if (test_delegate_) |
| + test_delegate_->OnConnectionError(); |
| + |
| + // Placeholder. This should handle cases when the reporter process sends |
| + // a bad message and the prompt dialog is being shown to the user. |
| +} |
| + |
| +// static |
| +void ChromePromptImpl::SetTestDelegate( |
| + ChromePromptImpl::TestDelegate* test_delegate) { |
| + test_delegate_ = test_delegate; |
| +} |
| + |
| +// static |
| +ChromePromptImpl::TestDelegate* ChromePromptImpl::test_delegate_ = nullptr; |
| + |
| } // namespace safe_browsing |