OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 824 matching lines...) Loading... |
835 } | 835 } |
836 | 836 |
837 scanning_ = false; | 837 scanning_ = false; |
838 lock->Release(); | 838 lock->Release(); |
839 | 839 |
840 HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", | 840 HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", |
841 suspected_bad_modules_detected_); | 841 suspected_bad_modules_detected_); |
842 HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", | 842 HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", |
843 confirmed_bad_modules_detected_); | 843 confirmed_bad_modules_detected_); |
844 | 844 |
845 if (!limited_mode_) { | 845 // Notifications are not available in limited mode. |
| 846 if (limited_mode_) |
| 847 return; |
| 848 |
| 849 NotificationService::current()->Notify( |
| 850 NotificationType::MODULE_LIST_ENUMERATED, |
| 851 Source<EnumerateModulesModel>(this), |
| 852 NotificationService::NoDetails()); |
| 853 |
| 854 // Command line flag must be enabled for the notification to get sent out. |
| 855 // Otherwise we'd get the badge (while the feature is disabled) when we |
| 856 // navigate to about:conflicts and find confirmed matches. |
| 857 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
| 858 if (!cmd_line.HasSwitch(switches::kConflictingModulesCheck)) |
| 859 return; |
| 860 |
| 861 if (suspected_bad_modules_detected_ || confirmed_bad_modules_detected_) { |
| 862 bool found_confirmed_bad_modules = confirmed_bad_modules_detected_ > 0; |
846 NotificationService::current()->Notify( | 863 NotificationService::current()->Notify( |
847 NotificationType::MODULE_LIST_ENUMERATED, | 864 NotificationType::MODULE_INCOMPATIBILITY_DETECTED, |
848 Source<EnumerateModulesModel>(this), | 865 Source<EnumerateModulesModel>(this), |
849 NotificationService::NoDetails()); | 866 Details<bool>(&found_confirmed_bad_modules)); |
850 | |
851 if (suspected_bad_modules_detected_ || confirmed_bad_modules_detected_) { | |
852 bool found_confirmed_bad_modules = confirmed_bad_modules_detected_ > 0; | |
853 NotificationService::current()->Notify( | |
854 NotificationType::MODULE_INCOMPATIBILITY_DETECTED, | |
855 Source<EnumerateModulesModel>(this), | |
856 Details<bool>(&found_confirmed_bad_modules)); | |
857 } | |
858 } | 867 } |
859 } | 868 } |
860 | 869 |
861 GURL EnumerateModulesModel::ConstructHelpCenterUrl( | 870 GURL EnumerateModulesModel::ConstructHelpCenterUrl( |
862 const ModuleEnumerator::Module& module) { | 871 const ModuleEnumerator::Module& module) { |
863 if (!(module.recommended_action & ModuleEnumerator::SEE_LINK)) | 872 if (!(module.recommended_action & ModuleEnumerator::SEE_LINK)) |
864 return GURL(); | 873 return GURL(); |
865 | 874 |
866 // Construct the needed hashes. | 875 // Construct the needed hashes. |
867 std::string filename, location, description, signer; | 876 std::string filename, location, description, signer; |
868 GenerateHash(WideToUTF8(module.name), &filename); | 877 GenerateHash(WideToUTF8(module.name), &filename); |
869 GenerateHash(WideToUTF8(module.location), &location); | 878 GenerateHash(WideToUTF8(module.location), &location); |
870 GenerateHash(WideToUTF8(module.description), &description); | 879 GenerateHash(WideToUTF8(module.description), &description); |
871 GenerateHash(WideToUTF8(module.digital_signer), &signer); | 880 GenerateHash(WideToUTF8(module.digital_signer), &signer); |
872 | 881 |
873 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, | 882 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, |
874 ASCIIToUTF16(filename), ASCIIToUTF16(location), | 883 ASCIIToUTF16(filename), ASCIIToUTF16(location), |
875 ASCIIToUTF16(description), ASCIIToUTF16(signer)); | 884 ASCIIToUTF16(description), ASCIIToUTF16(signer)); |
876 return GURL(UTF16ToUTF8(url)); | 885 return GURL(UTF16ToUTF8(url)); |
877 } | 886 } |
OLD | NEW |