Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: chrome/browser/safe_browsing/srt_chrome_prompt_impl.h

Issue 2834613003: Adds error handling support for the SwReporter launcher. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/srt_chrome_prompt_impl.h
diff --git a/chrome/browser/safe_browsing/srt_chrome_prompt_impl.h b/chrome/browser/safe_browsing/srt_chrome_prompt_impl.h
index bf14b30ff80655a3d21a277e5e7072eeae42b919..9d03171371329074be9d45e506d774958a81f3c5 100644
--- a/chrome/browser/safe_browsing/srt_chrome_prompt_impl.h
+++ b/chrome/browser/safe_browsing/srt_chrome_prompt_impl.h
@@ -13,6 +13,13 @@ namespace safe_browsing {
// Implementation of the ChromePrompt Mojo interface.
class ChromePromptImpl : public chrome_cleaner::mojom::ChromePrompt {
public:
+ // 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.
+ class TestDelegate {
+ public:
+ virtual void OnPromptUser() = 0;
+ virtual void OnConnectionError() = 0;
+ };
+
explicit ChromePromptImpl(chrome_cleaner::mojom::ChromePromptRequest request);
~ChromePromptImpl() override;
@@ -22,8 +29,19 @@ class ChromePromptImpl : public chrome_cleaner::mojom::ChromePrompt {
const chrome_cleaner::mojom::ChromePrompt::PromptUserCallback& callback)
override;
+ // Handles the case when the remote end has been closed, by performing the
+ // necessary cleanups if the prompt dialog is being shown to the user.
+ void OnConnectionClosed();
+
+ // Handles the case when a mojo::ReportBadMessage has been explicitely
+ // reported.
+ void OnConnectionError(const std::string& message);
+
+ static void SetTestDelegate(TestDelegate* test_delegate);
+
private:
mojo::Binding<chrome_cleaner::mojom::ChromePrompt> binding_;
+ 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
};
grt (UTC plus 2) 2017/04/21 11:10:58 DISALLOW_COPY_AND_ASSIGN?
ftirelo 2017/04/24 15:47:45 Done.
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698