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 a02056729d5277fa06e43e8689d1d27443371938..2a92558f675031d393c2baca175dfabd778613d9 100644 |
--- a/chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
+++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc |
@@ -66,9 +66,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 +86,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(); |
Lei Zhang
2016/08/04 14:33:32
auto*
chrisha
2016/08/12 19:04:40
Done.
|
+ modules->AddObserver(this); |
Peter Kasting
2016/08/05 00:10:08
Nit: Consider whether it would be cleaner or safer
chrisha
2016/08/12 19:04:40
I'm not a huge fan of precompiler logic in initial
|
+ modules->MaybePostScanningTask(); |
#endif |
} |
-AppMenuIconController::~AppMenuIconController() {} |
+AppMenuIconController::~AppMenuIconController() { |
+#if defined(OS_WIN) |
+ EnumerateModulesModel::GetInstance()->RemoveObserver(this); |
+#endif |
+} |
void AppMenuIconController::UpdateDelegate() { |
if (ShouldShowUpgradeRecommended()) { |
@@ -123,6 +126,17 @@ void AppMenuIconController::UpdateDelegate() { |
delegate_->UpdateSeverity(IconType::NONE, |
AppMenuIconPainter::SEVERITY_NONE, true); |
} |
+ |
+#if defined(OS_WIN) |
+void AppMenuIconController::OnScanCompleted() { |
+ UpdateDelegate(); |
+} |
+ |
+void AppMenuIconController::OnConflictsAcknowledged() { |
+ UpdateDelegate(); |
+} |
+#endif |
+ |
void AppMenuIconController::Observe( |
int type, |
const content::NotificationSource& source, |