Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4912)

Unified Diff: chrome/browser/ui/toolbar/app_menu_icon_controller.cc

Issue 2037883004: [Win] Add reporting of total number of modules loaded in browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing include. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698