Index: chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
diff --git a/chrome/browser/ui/toolbar/app_menu_icon_controller.cc b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
index 460845aa8fb987c3422a4108b874b2857a5fa70d..26eb37e4f90a7034e5b883bd79eac490b6d21ade 100644 |
--- a/chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
+++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
@@ -13,7 +13,6 @@ |
#if defined(OS_WIN) |
#include "base/win/windows_version.h" |
-#include "chrome/browser/enumerate_modules_model_win.h" |
#endif |
namespace { |
@@ -66,9 +65,7 @@ bool ShouldShowUpgradeRecommended() { |
// Returns true if we should show the warning for incompatible software. |
bool ShouldShowIncompatibilityWarning() { |
#if defined(OS_WIN) |
- EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); |
- loaded_modules->MaybePostScanningTask(); |
- return loaded_modules->ShouldShowConflictWarning(); |
+ return EnumerateModulesModel::GetInstance()->ShouldShowConflictWarning(); |
#else |
return false; |
#endif |
@@ -88,12 +85,17 @@ AppMenuIconController::AppMenuIconController(Profile* profile, |
content::Source<Profile>(profile_)); |
#if defined(OS_WIN) |
- registrar_.Add(this, chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_ICON_CHANGE, |
- content::NotificationService::AllSources()); |
+ auto modules = EnumerateModulesModel::GetInstance(); |
+ modules->AddObserver(this); |
+ modules->MaybePostScanningTask(); |
#endif |
} |
-AppMenuIconController::~AppMenuIconController() {} |
+AppMenuIconController::~AppMenuIconController() { |
+#if defined(OS_WIN) |
+ EnumerateModulesModel::GetInstance()->RemoveObserver(this); |
+#endif |
+} |
void AppMenuIconController::UpdateDelegate() { |
if (ShouldShowUpgradeRecommended()) { |
@@ -123,6 +125,18 @@ void AppMenuIconController::UpdateDelegate() { |
delegate_->UpdateSeverity(IconType::NONE, |
AppMenuIconPainter::SEVERITY_NONE, true); |
} |
+ |
+#if defined(OS_WIN) |
+void AppMenuIconController::OnScanCompleted(bool limited_mode) { |
+ if (!limited_mode) |
+ UpdateDelegate(); |
+} |
+ |
+void AppMenuIconController::OnConflictsAcknowledged() { |
+ UpdateDelegate(); |
+} |
+#endif |
+ |
void AppMenuIconController::Observe( |
int type, |
const content::NotificationSource& source, |