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

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

Issue 2925973002: Migrate upgrade notifications to observer (Closed)
Patch Set: Add DISALLOW_COPY_AND_ASSIGN Created 3 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 2d67da24e355e5f67395964cead480273f40ff08..79b6acb49e7ffd3862077472f3e95a422b4c51c1 100644
--- a/chrome/browser/ui/toolbar/app_menu_icon_controller.cc
+++ b/chrome/browser/ui/toolbar/app_menu_icon_controller.cc
@@ -71,11 +71,11 @@ AppMenuIconController::AppMenuIconController(Profile* profile,
DCHECK(profile_);
DCHECK(delegate_);
- registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
- content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
content::Source<Profile>(profile_));
+ UpgradeDetector::GetInstance()->AddObserver(this);
+
#if defined(OS_WIN)
auto* modules = EnumerateModulesModel::GetInstance();
modules->AddObserver(this);
@@ -84,6 +84,8 @@ AppMenuIconController::AppMenuIconController(Profile* profile,
}
AppMenuIconController::~AppMenuIconController() {
+ UpgradeDetector::GetInstance()->RemoveObserver(this);
+
#if defined(OS_WIN)
EnumerateModulesModel::GetInstance()->RemoveObserver(this);
#endif
@@ -131,5 +133,10 @@ void AppMenuIconController::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ DCHECK_EQ(chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, type);
+ UpdateDelegate();
+}
+
+void AppMenuIconController::OnUpgradeRecommended() {
UpdateDelegate();
}
« no previous file with comments | « chrome/browser/ui/toolbar/app_menu_icon_controller.h ('k') | chrome/browser/ui/toolbar/app_menu_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698