Index: chrome/browser/ui/webui/cleanup_tool/cleanup_action_handler.cc |
diff --git a/chrome/browser/ui/webui/cleanup_tool/cleanup_action_handler.cc b/chrome/browser/ui/webui/cleanup_tool/cleanup_action_handler.cc |
index 1a84b1aebcf12e1a89f46067f1b4f0e15f51f126..36bf966ab3e432ab263a3db141cb313fd78b0a40 100644 |
--- a/chrome/browser/ui/webui/cleanup_tool/cleanup_action_handler.cc |
+++ b/chrome/browser/ui/webui/cleanup_tool/cleanup_action_handler.cc |
@@ -6,6 +6,9 @@ |
#include "base/bind.h" |
#include "base/values.h" |
+#include "chrome/browser/safe_browsing/srt_fetcher_win.h" |
+#include "chrome/browser/ui/browser_dialogs.h" |
+#include "chrome/browser/ui/browser_finder.h" |
CleanupActionHandler::CleanupActionHandler() {} |
@@ -16,6 +19,9 @@ void CleanupActionHandler::RegisterMessages() { |
"requestLastScanResult", |
base::Bind(&CleanupActionHandler::HandleRequestLastScanResult, |
base::Unretained(this))); |
+ web_ui()->RegisterMessageCallback( |
+ "startCleanup", base::Bind(&CleanupActionHandler::HandleStartCleanup, |
+ base::Unretained(this))); |
} |
void CleanupActionHandler::HandleRequestLastScanResult( |
@@ -36,3 +42,23 @@ void CleanupActionHandler::HandleRequestLastScanResult( |
AllowJavascript(); |
ResolveJavascriptCallback(base::Value(webui_callback_id), last_scan_results); |
} |
+ |
+void CleanupActionHandler::HandleStartCleanup(const base::ListValue* args) { |
+ std::string webui_callback_id; |
+ CHECK_EQ(1U, args->GetSize()); |
alito
2017/04/14 00:01:18
Move this to the previous line?
proberge
2017/04/18 19:24:28
Done.
|
+ bool success = args->GetString(0, &webui_callback_id); |
+ DCHECK(success); |
+ |
+ safe_browsing::DisplayUserInitiatedSRTPromptDialog( |
+ base::Bind(&CleanupActionHandler::ReportCleanupResults, |
+ base::Unretained(this), webui_callback_id)); |
+} |
+ |
+void CleanupActionHandler::ReportCleanupResults( |
+ const std::string& callback_id) { |
+ base::DictionaryValue cleanup_results; |
+ // TODO(proberge): Return real information about the cleanup. |
+ cleanup_results.SetBoolean("wasCancelled", true); |
+ |
+ ResolveJavascriptCallback(base::Value(callback_id), cleanup_results); |
+} |