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

Unified Diff: chrome/browser/ui/webui/help/help_handler.cc

Issue 2925973002: Migrate upgrade notifications to observer (Closed)
Patch Set: Fix test failure 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/webui/help/help_handler.cc
diff --git a/chrome/browser/ui/webui/help/help_handler.cc b/chrome/browser/ui/webui/help/help_handler.cc
index 6f729d1651b14c87d32dfb19c9db0322a699540d..69ddaa54a87b942ceb9a1b9b43d9de837520310d 100644
--- a/chrome/browser/ui/webui/help/help_handler.cc
+++ b/chrome/browser/ui/webui/help/help_handler.cc
@@ -26,13 +26,13 @@
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/upgrade_detector.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/pref_names.h"
@@ -46,7 +46,6 @@
#include "components/strings/grit/components_strings.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "ui/base/l10n/l10n_util.h"
@@ -374,8 +373,7 @@ void HelpHandler::GetLocalizedValues(base::DictionaryValue* localized_strings) {
void HelpHandler::RegisterMessages() {
version_updater_.reset(VersionUpdater::Create(web_ui()->GetWebContents()));
- registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
- content::NotificationService::AllSources());
+ UpgradeDetector::GetInstance()->AddObserver(this);
sky 2017/06/07 23:01:41 I don't see a corresponding remove?
weidongg 2017/06/08 02:28:42 Added AddObserver and RemoveObserver in constructo
policy_registrar_.Observe(
policy::key::kDeviceAutoUpdateDisabled,
base::Bind(&HelpHandler::OnDeviceAutoUpdatePolicyChanged,
@@ -409,10 +407,7 @@ void HelpHandler::RegisterMessages() {
#endif
}
-void HelpHandler::Observe(int type, const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type);
-
+void HelpHandler::OnUpgradeRecommended() {
// A version update is installed and ready to go. Refresh the UI so the
// correct state will be shown.
RequestUpdate(nullptr);

Powered by Google App Engine
This is Rietveld 408576698