OLD | NEW |
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/enumerate_modules_model_win.h" | 5 #include "chrome/browser/enumerate_modules_model_win.h" |
6 | 6 |
7 #include <Tlhelp32.h> | 7 #include <Tlhelp32.h> |
8 #include <wintrust.h> | 8 #include <wintrust.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 | 850 |
851 scanning_ = true; | 851 scanning_ = true; |
852 | 852 |
853 // Instruct the ModuleEnumerator class to load this on the File thread. | 853 // Instruct the ModuleEnumerator class to load this on the File thread. |
854 // ScanNow does not block. | 854 // ScanNow does not block. |
855 if (!module_enumerator_) | 855 if (!module_enumerator_) |
856 module_enumerator_ = new ModuleEnumerator(this); | 856 module_enumerator_ = new ModuleEnumerator(this); |
857 module_enumerator_->ScanNow(&enumerated_modules_, limited_mode_); | 857 module_enumerator_->ScanNow(&enumerated_modules_, limited_mode_); |
858 } | 858 } |
859 | 859 |
860 ListValue* EnumerateModulesModel::GetModuleList() const { | 860 base::ListValue* EnumerateModulesModel::GetModuleList() const { |
861 if (scanning_) | 861 if (scanning_) |
862 return NULL; | 862 return NULL; |
863 | 863 |
864 lock->Acquire(); | 864 lock->Acquire(); |
865 | 865 |
866 if (enumerated_modules_.empty()) { | 866 if (enumerated_modules_.empty()) { |
867 lock->Release(); | 867 lock->Release(); |
868 return NULL; | 868 return NULL; |
869 } | 869 } |
870 | 870 |
871 ListValue* list = new ListValue(); | 871 base::ListValue* list = new base::ListValue(); |
872 | 872 |
873 for (ModuleEnumerator::ModulesVector::const_iterator module = | 873 for (ModuleEnumerator::ModulesVector::const_iterator module = |
874 enumerated_modules_.begin(); | 874 enumerated_modules_.begin(); |
875 module != enumerated_modules_.end(); ++module) { | 875 module != enumerated_modules_.end(); ++module) { |
876 DictionaryValue* data = new DictionaryValue(); | 876 base::DictionaryValue* data = new base::DictionaryValue(); |
877 data->SetInteger("type", module->type); | 877 data->SetInteger("type", module->type); |
878 base::string16 type_string; | 878 base::string16 type_string; |
879 if ((module->type & ModuleEnumerator::LOADED_MODULE) == 0) { | 879 if ((module->type & ModuleEnumerator::LOADED_MODULE) == 0) { |
880 // Module is not loaded, denote type of module. | 880 // Module is not loaded, denote type of module. |
881 if (module->type & ModuleEnumerator::SHELL_EXTENSION) | 881 if (module->type & ModuleEnumerator::SHELL_EXTENSION) |
882 type_string = ASCIIToWide("Shell Extension"); | 882 type_string = ASCIIToWide("Shell Extension"); |
883 if (module->type & ModuleEnumerator::WINSOCK_MODULE_REGISTRATION) { | 883 if (module->type & ModuleEnumerator::WINSOCK_MODULE_REGISTRATION) { |
884 if (!type_string.empty()) | 884 if (!type_string.empty()) |
885 type_string += ASCIIToWide(", "); | 885 type_string += ASCIIToWide(", "); |
886 type_string += ASCIIToWide("Winsock"); | 886 type_string += ASCIIToWide("Winsock"); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 GenerateHash(WideToUTF8(module.location), &location); | 1060 GenerateHash(WideToUTF8(module.location), &location); |
1061 GenerateHash(WideToUTF8(module.description), &description); | 1061 GenerateHash(WideToUTF8(module.description), &description); |
1062 GenerateHash(WideToUTF8(module.digital_signer), &signer); | 1062 GenerateHash(WideToUTF8(module.digital_signer), &signer); |
1063 | 1063 |
1064 base::string16 url = | 1064 base::string16 url = |
1065 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 1065 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
1066 ASCIIToUTF16(filename), ASCIIToUTF16(location), | 1066 ASCIIToUTF16(filename), ASCIIToUTF16(location), |
1067 ASCIIToUTF16(description), ASCIIToUTF16(signer)); | 1067 ASCIIToUTF16(description), ASCIIToUTF16(signer)); |
1068 return GURL(UTF16ToUTF8(url)); | 1068 return GURL(UTF16ToUTF8(url)); |
1069 } | 1069 } |
OLD | NEW |