| 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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 EnumerateModulesModel::~EnumerateModulesModel() { | 980 EnumerateModulesModel::~EnumerateModulesModel() { |
| 981 delete lock; | 981 delete lock; |
| 982 } | 982 } |
| 983 | 983 |
| 984 void EnumerateModulesModel::MaybePostScanningTask() { | 984 void EnumerateModulesModel::MaybePostScanningTask() { |
| 985 static bool done = false; | 985 static bool done = false; |
| 986 if (!done) { | 986 if (!done) { |
| 987 done = true; | 987 done = true; |
| 988 | 988 |
| 989 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 989 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
| 990 if (cmd_line.HasSwitch(switches::kConflictingModulesCheck) || | 990 if (base::win::GetVersion() == base::win::VERSION_XP) { |
| 991 base::win::GetVersion() == base::win::VERSION_XP) { | |
| 992 check_modules_timer_.Start(FROM_HERE, | 991 check_modules_timer_.Start(FROM_HERE, |
| 993 base::TimeDelta::FromMilliseconds(kModuleCheckDelayMs), | 992 base::TimeDelta::FromMilliseconds(kModuleCheckDelayMs), |
| 994 this, &EnumerateModulesModel::ScanNow); | 993 this, &EnumerateModulesModel::ScanNow); |
| 995 } | 994 } |
| 996 } | 995 } |
| 997 } | 996 } |
| 998 | 997 |
| 999 void EnumerateModulesModel::DoneScanning() { | 998 void EnumerateModulesModel::DoneScanning() { |
| 1000 confirmed_bad_modules_detected_ = 0; | 999 confirmed_bad_modules_detected_ = 0; |
| 1001 suspected_bad_modules_detected_ = 0; | 1000 suspected_bad_modules_detected_ = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1023 confirmed_bad_modules_detected_); | 1022 confirmed_bad_modules_detected_); |
| 1024 | 1023 |
| 1025 // Notifications are not available in limited mode. | 1024 // Notifications are not available in limited mode. |
| 1026 if (limited_mode_) | 1025 if (limited_mode_) |
| 1027 return; | 1026 return; |
| 1028 | 1027 |
| 1029 content::NotificationService::current()->Notify( | 1028 content::NotificationService::current()->Notify( |
| 1030 chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, | 1029 chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, |
| 1031 content::Source<EnumerateModulesModel>(this), | 1030 content::Source<EnumerateModulesModel>(this), |
| 1032 content::NotificationService::NoDetails()); | 1031 content::NotificationService::NoDetails()); |
| 1033 | |
| 1034 // Command line flag must be enabled for the notification to get sent out. | |
| 1035 // Otherwise we'd get the badge (while the feature is disabled) when we | |
| 1036 // navigate to about:conflicts and find confirmed matches. | |
| 1037 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | |
| 1038 if (!cmd_line.HasSwitch(switches::kConflictingModulesCheck)) | |
| 1039 return; | |
| 1040 | |
| 1041 content::NotificationService::current()->Notify( | |
| 1042 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, | |
| 1043 content::Source<EnumerateModulesModel>(this), | |
| 1044 content::NotificationService::NoDetails()); | |
| 1045 } | 1032 } |
| 1046 | 1033 |
| 1047 GURL EnumerateModulesModel::ConstructHelpCenterUrl( | 1034 GURL EnumerateModulesModel::ConstructHelpCenterUrl( |
| 1048 const ModuleEnumerator::Module& module) const { | 1035 const ModuleEnumerator::Module& module) const { |
| 1049 if (!(module.recommended_action & ModuleEnumerator::SEE_LINK) && | 1036 if (!(module.recommended_action & ModuleEnumerator::SEE_LINK) && |
| 1050 !(module.recommended_action & ModuleEnumerator::NOTIFY_USER)) | 1037 !(module.recommended_action & ModuleEnumerator::NOTIFY_USER)) |
| 1051 return GURL(); | 1038 return GURL(); |
| 1052 | 1039 |
| 1053 // Construct the needed hashes. | 1040 // Construct the needed hashes. |
| 1054 std::string filename, location, description, signer; | 1041 std::string filename, location, description, signer; |
| 1055 GenerateHash(base::WideToUTF8(module.name), &filename); | 1042 GenerateHash(base::WideToUTF8(module.name), &filename); |
| 1056 GenerateHash(base::WideToUTF8(module.location), &location); | 1043 GenerateHash(base::WideToUTF8(module.location), &location); |
| 1057 GenerateHash(base::WideToUTF8(module.description), &description); | 1044 GenerateHash(base::WideToUTF8(module.description), &description); |
| 1058 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); | 1045 GenerateHash(base::WideToUTF8(module.digital_signer), &signer); |
| 1059 | 1046 |
| 1060 base::string16 url = | 1047 base::string16 url = |
| 1061 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 1048 l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
| 1062 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), | 1049 base::ASCIIToUTF16(filename), base::ASCIIToUTF16(location), |
| 1063 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); | 1050 base::ASCIIToUTF16(description), base::ASCIIToUTF16(signer)); |
| 1064 return GURL(base::UTF16ToUTF8(url)); | 1051 return GURL(base::UTF16ToUTF8(url)); |
| 1065 } | 1052 } |
| OLD | NEW |