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

Side by Side Diff: chrome/browser/win/enumerate_modules_model.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/win/enumerate_modules_model.h" 5 #include "chrome/browser/win/enumerate_modules_model.h"
6 6
7 #include <softpub.h> 7 #include <softpub.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <tlhelp32.h> 10 #include <tlhelp32.h>
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 return; 582 return;
583 } 583 }
584 584
585 // ScanNow does not block, rather it simply schedules a task. 585 // ScanNow does not block, rather it simply schedules a task.
586 module_enumerator_.reset(new ModuleEnumerator(this)); 586 module_enumerator_.reset(new ModuleEnumerator(this));
587 if (!background_mode) 587 if (!background_mode)
588 module_enumerator_->SetPerModuleDelayToZero(); 588 module_enumerator_->SetPerModuleDelayToZero();
589 module_enumerator_->ScanNow(&enumerated_modules_); 589 module_enumerator_->ScanNow(&enumerated_modules_);
590 } 590 }
591 591
592 base::ListValue* EnumerateModulesModel::GetModuleList() { 592 std::unique_ptr<base::ListValue> EnumerateModulesModel::GetModuleList() {
593 DCHECK_CURRENTLY_ON(BrowserThread::UI); 593 DCHECK_CURRENTLY_ON(BrowserThread::UI);
594 594
595 // If a |module_enumerator_| is still around then scanning has not yet 595 // If a |module_enumerator_| is still around then scanning has not yet
596 // completed, and it is unsafe to read from |enumerated_modules_|. 596 // completed, and it is unsafe to read from |enumerated_modules_|.
597 if (module_enumerator_.get()) 597 if (module_enumerator_.get())
598 return nullptr; 598 return nullptr;
599 599
600 if (enumerated_modules_.empty()) 600 if (enumerated_modules_.empty())
601 return nullptr; 601 return nullptr;
602 602
603 base::ListValue* list = new base::ListValue(); 603 auto list = base::MakeUnique<base::ListValue>();
604 604
605 for (ModuleEnumerator::ModulesVector::const_iterator module = 605 for (ModuleEnumerator::ModulesVector::const_iterator module =
606 enumerated_modules_.begin(); 606 enumerated_modules_.begin();
607 module != enumerated_modules_.end(); ++module) { 607 module != enumerated_modules_.end(); ++module) {
608 auto data = base::MakeUnique<base::DictionaryValue>(); 608 auto data = base::MakeUnique<base::DictionaryValue>();
609 data->SetInteger("type", module->type); 609 data->SetInteger("type", module->type);
610 base::string16 type_string; 610 base::string16 type_string;
611 if ((module->type & ModuleEnumerator::LOADED_MODULE) == 0) { 611 if ((module->type & ModuleEnumerator::LOADED_MODULE) == 0) {
612 // Module is not loaded, denote type of module. 612 // Module is not loaded, denote type of module.
613 if (module->type & ModuleEnumerator::SHELL_EXTENSION) 613 if (module->type & ModuleEnumerator::SHELL_EXTENSION)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 718
719 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", 719 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules",
720 suspected_bad_modules_detected_); 720 suspected_bad_modules_detected_);
721 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", 721 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules",
722 confirmed_bad_modules_detected_); 722 confirmed_bad_modules_detected_);
723 723
724 // Forward the callback to any registered observers. 724 // Forward the callback to any registered observers.
725 for (Observer& observer : observers_) 725 for (Observer& observer : observers_)
726 observer.OnScanCompleted(); 726 observer.OnScanCompleted();
727 } 727 }
OLDNEW
« no previous file with comments | « chrome/browser/win/enumerate_modules_model.h ('k') | chrome/test/chromedriver/performance_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698