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

Side by Side Diff: chrome/browser/ui/webui/conflicts_handler.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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 #include "chrome/browser/ui/webui/conflicts_handler.h" 5 #include "chrome/browser/ui/webui/conflicts_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 23 matching lines...) Expand all
34 observer_.Add(model); 34 observer_.Add(model);
35 35
36 // Ask the scan to be performed immediately, and not in background mode. 36 // Ask the scan to be performed immediately, and not in background mode.
37 // This ensures the results are available ASAP for the UI. 37 // This ensures the results are available ASAP for the UI.
38 model->ScanNow(false); 38 model->ScanNow(false);
39 } 39 }
40 } 40 }
41 41
42 void ConflictsHandler::SendModuleList() { 42 void ConflictsHandler::SendModuleList() {
43 auto* loaded_modules = EnumerateModulesModel::GetInstance(); 43 auto* loaded_modules = EnumerateModulesModel::GetInstance();
44 base::ListValue* list = loaded_modules->GetModuleList(); 44 std::unique_ptr<base::ListValue> list = loaded_modules->GetModuleList();
45 base::DictionaryValue results;
46 results.Set("moduleList", list);
47 45
48 // Add the section title and the total count for bad modules found. 46 // Add the section title and the total count for bad modules found.
49 int confirmed_bad = loaded_modules->confirmed_bad_modules_detected(); 47 int confirmed_bad = loaded_modules->confirmed_bad_modules_detected();
50 int suspected_bad = loaded_modules->suspected_bad_modules_detected(); 48 int suspected_bad = loaded_modules->suspected_bad_modules_detected();
51 base::string16 table_title; 49 base::string16 table_title;
52 if (!confirmed_bad && !suspected_bad) { 50 if (!confirmed_bad && !suspected_bad) {
53 table_title += l10n_util::GetStringFUTF16( 51 table_title += l10n_util::GetStringFUTF16(
54 IDS_CONFLICTS_CHECK_PAGE_TABLE_TITLE_SUFFIX_ONE, 52 IDS_CONFLICTS_CHECK_PAGE_TABLE_TITLE_SUFFIX_ONE,
55 base::IntToString16(list->GetSize())); 53 base::IntToString16(list->GetSize()));
56 } else { 54 } else {
57 table_title += l10n_util::GetStringFUTF16( 55 table_title += l10n_util::GetStringFUTF16(
58 IDS_CONFLICTS_CHECK_PAGE_TABLE_TITLE_SUFFIX_TWO, 56 IDS_CONFLICTS_CHECK_PAGE_TABLE_TITLE_SUFFIX_TWO,
59 base::IntToString16(list->GetSize()), 57 base::IntToString16(list->GetSize()),
60 base::IntToString16(confirmed_bad), base::IntToString16(suspected_bad)); 58 base::IntToString16(confirmed_bad), base::IntToString16(suspected_bad));
61 } 59 }
60 base::DictionaryValue results;
61 results.Set("moduleList", std::move(list));
62 results.SetString("modulesTableTitle", table_title); 62 results.SetString("modulesTableTitle", table_title);
63 63
64 web_ui()->CallJavascriptFunctionUnsafe("returnModuleList", results); 64 web_ui()->CallJavascriptFunctionUnsafe("returnModuleList", results);
65 } 65 }
66 66
67 void ConflictsHandler::OnScanCompleted() { 67 void ConflictsHandler::OnScanCompleted() {
68 SendModuleList(); 68 SendModuleList();
69 observer_.Remove(EnumerateModulesModel::GetInstance()); 69 observer_.Remove(EnumerateModulesModel::GetInstance());
70 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/metadata_database.cc ('k') | chrome/browser/win/enumerate_modules_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698