Use ExtensionRegistryObserver instead of deprecated notification.
These two should be done together. To make
ProcessManager::OnExtesnionUnloaded call AppRestoreService::OnAppStop() first.
and then AppWindow::OnExtensionUnloaded should be called.

BUG=411568, 419375

Review URL: https://codereview.chromium.org/953413002

Cr-Commit-Position: refs/heads/master@{#318350}
diff --git a/extensions/browser/process_manager.h b/extensions/browser/process_manager.h
index 60056a1..16691b4 100644
--- a/extensions/browser/process_manager.h
+++ b/extensions/browser/process_manager.h
@@ -18,6 +18,7 @@
 #include "components/keyed_service/core/keyed_service.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
+#include "extensions/browser/extension_registry_observer.h"
 #include "extensions/common/view_type.h"
 
 class GURL;
@@ -42,7 +43,8 @@
 // of this class per Profile. OTR Profiles have a separate instance that keeps
 // track of split-mode extensions only.
 class ProcessManager : public KeyedService,
-                       public content::NotificationObserver {
+                       public content::NotificationObserver,
+                       public ExtensionRegistryObserver {
  public:
   typedef std::set<extensions::ExtensionHost*> ExtensionHostSet;
   typedef ExtensionHostSet::const_iterator const_iterator;
@@ -201,6 +203,13 @@
                const content::NotificationSource& source,
                const content::NotificationDetails& details) override;
 
+  // ExtensionRegistryObserver:
+  void OnExtensionLoaded(content::BrowserContext* browser_context,
+                         const Extension* extension) override;
+  void OnExtensionUnloaded(content::BrowserContext* browser_context,
+                           const Extension* extension,
+                           UnloadedExtensionInfo::Reason reason) override;
+
   content::NotificationRegistrar registrar_;
 
   // The set of ExtensionHosts running viewless background extensions.