Chromium Code Reviews| Index: chrome/browser/ui/webui/settings/about_handler.cc |
| diff --git a/chrome/browser/ui/webui/settings/about_handler.cc b/chrome/browser/ui/webui/settings/about_handler.cc |
| index 05db7d110ad4724be4d4b66ca7ceb19fa7fab85d..a311fa4ff179282cfbc254853af49b744fa299c4 100644 |
| --- a/chrome/browser/ui/webui/settings/about_handler.cc |
| +++ b/chrome/browser/ui/webui/settings/about_handler.cc |
| @@ -27,12 +27,12 @@ |
| #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/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 "content/public/browser/web_ui_data_source.h" |
| @@ -386,8 +385,7 @@ void AboutHandler::RegisterMessages() { |
| void AboutHandler::OnJavascriptAllowed() { |
| version_updater_.reset(VersionUpdater::Create(web_ui()->GetWebContents())); |
| - registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| - content::NotificationService::AllSources()); |
| + UpgradeDetector::GetInstance()->AddObserver(this); |
| policy_registrar_.reset(new policy::PolicyChangeRegistrar( |
| g_browser_process->policy_service(), |
| policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()))); |
| @@ -400,15 +398,10 @@ void AboutHandler::OnJavascriptAllowed() { |
| void AboutHandler::OnJavascriptDisallowed() { |
|
sky
2017/06/07 23:01:42
Is there a guarantee that this is called before th
weidongg
2017/06/08 02:28:42
I am not sure, but I moved AddObserver and RemoveO
|
| version_updater_.reset(); |
| policy_registrar_.reset(); |
| - registrar_.Remove(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| - content::NotificationService::AllSources()); |
| + UpgradeDetector::GetInstance()->RemoveObserver(this); |
| } |
| -void AboutHandler::Observe(int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) { |
| - DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); |
| - |
| +void AboutHandler::OnUpgradeRecommended() { |
| // A version update is installed and ready to go. Refresh the UI so the |
| // correct state will be shown. |
| RequestUpdate(); |