OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/webui/cleanup_tool/cleanup_action_handler.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/values.h" | |
9 #include "chrome/grit/generated_resources.h" | |
10 #include "ui/base/l10n/l10n_util.h" | |
Dan Beam
2017/04/04 00:00:00
why are these bottom 2 #includes needed?
proberge
2017/04/04 16:10:08
They were used before I split this CL. Removed for
| |
11 | |
12 CleanupActionHandler::CleanupActionHandler() {} | |
13 | |
14 void CleanupActionHandler::RegisterMessages() { | |
15 web_ui()->RegisterMessageCallback( | |
16 "requestLastScanResult", | |
17 base::Bind(&CleanupActionHandler::HandleRequestLastScanResult, | |
18 base::Unretained(this))); | |
19 } | |
20 | |
21 void CleanupActionHandler::HandleRequestLastScanResult( | |
22 const base::ListValue* args) { | |
23 std::string webui_callback_id; | |
24 CHECK_EQ(1U, args->GetSize()); | |
25 bool success = args->GetString(0, &webui_callback_id); | |
Dan Beam
2017/04/04 00:00:00
can you just get this as a base::Value instead of
proberge
2017/04/04 16:10:07
I copied this pattern from https://cs.chromium.org
| |
26 DCHECK(success); | |
27 | |
28 base::DictionaryValue last_scan_results; | |
29 // TODO(proberge): Return real information about the last run. | |
30 // TODO(proberge): Localize strings once they are finalized. | |
31 last_scan_results.SetBoolean("hasScanResults", false); | |
32 last_scan_results.SetBoolean("isInfected", false); | |
33 last_scan_results.SetString("detectionStatusText", "No problems detected"); | |
34 last_scan_results.SetString("detectionTimeText", "Last scanned today"); | |
35 | |
36 AllowJavascript(); | |
37 ResolveJavascriptCallback(base::Value(webui_callback_id), last_scan_results); | |
38 } | |
OLD | NEW |