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

Unified Diff: chrome/browser/extensions/extension_service.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/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 66bbac75636d6794cd2cee36b5e26afb55b38814..2e7bc53a64b7c0abc40c2aaf049e8b6860993a4f 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -60,6 +60,7 @@
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/ui/webui/favicon_source.h"
#include "chrome/browser/ui/webui/theme_source.h"
+#include "chrome/browser/upgrade_detector.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/crash_keys.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -351,12 +352,12 @@ ExtensionService::ExtensionService(Profile* profile,
content::NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
content::NotificationService::AllBrowserContextsAndSources());
- registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
- content::NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
content::Source<Profile>(profile_));
+ UpgradeDetector::GetInstance()->AddObserver(this);
+
extensions::ExtensionManagementFactory::GetForBrowserContext(profile_)
->AddObserver(this);
@@ -413,6 +414,7 @@ extensions::PendingExtensionManager*
}
ExtensionService::~ExtensionService() {
+ UpgradeDetector::GetInstance()->RemoveObserver(this);
// No need to unload extensions here because they are profile-scoped, and the
// profile is in the process of being deleted.
for (const auto& provider : external_extension_providers_)
@@ -2248,12 +2250,6 @@ void ExtensionService::Observe(int type,
system_->info_map(), process->GetID()));
break;
}
- case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
- // Notify observers that chrome update is available.
- for (auto& observer : update_observers_)
- observer.OnChromeUpdateAvailable();
- break;
- }
case chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED: {
OnProfileDestructionStarted();
break;
@@ -2359,6 +2355,12 @@ void ExtensionService::OnBlacklistUpdated() {
base::Bind(&ExtensionService::ManageBlacklist, AsWeakPtr()));
}
+void ExtensionService::OnUpgradeRecommended() {
+ // Notify observers that chrome update is available.
+ for (auto& observer : update_observers_)
+ observer.OnChromeUpdateAvailable();
+}
+
void ExtensionService::ManageBlacklist(
const extensions::Blacklist::BlacklistStateMap& state_map) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/service_process/service_process_control.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698