Index: apps/app_window_geometry_cache.cc |
diff --git a/apps/app_window_geometry_cache.cc b/apps/app_window_geometry_cache.cc |
index c89988b9a3736966f5abd6366d4a64ae080c5292..ce6290ececc22afe1f126529e80e628abdc969e5 100644 |
--- a/apps/app_window_geometry_cache.cc |
+++ b/apps/app_window_geometry_cache.cc |
@@ -7,14 +7,12 @@ |
#include "base/bind.h" |
#include "base/stl_util.h" |
#include "base/strings/string_number_conversions.h" |
-#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/profiles/incognito_helpers.h" |
#include "chrome/browser/profiles/profile.h" |
#include "components/keyed_service/content/browser_context_dependency_manager.h" |
-#include "content/public/browser/notification_service.h" |
-#include "content/public/browser/notification_types.h" |
#include "extensions/browser/extension_prefs.h" |
#include "extensions/browser/extension_prefs_factory.h" |
+#include "extensions/browser/extension_registry.h" |
#include "extensions/browser/extensions_browser_client.h" |
#include "extensions/common/extension.h" |
@@ -32,13 +30,9 @@ AppWindowGeometryCache::AppWindowGeometryCache( |
Profile* profile, |
extensions::ExtensionPrefs* prefs) |
: prefs_(prefs), |
- sync_delay_(base::TimeDelta::FromMilliseconds(kSyncTimeoutMilliseconds)) { |
- registrar_.Add(this, |
- chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
- content::Source<Profile>(profile)); |
- registrar_.Add(this, |
- chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
- content::Source<Profile>(profile)); |
+ sync_delay_(base::TimeDelta::FromMilliseconds(kSyncTimeoutMilliseconds)), |
+ extension_registry_observer_(this) { |
+ extension_registry_observer_.Add(extensions::ExtensionRegistry::Get(profile)); |
} |
AppWindowGeometryCache::~AppWindowGeometryCache() {} |
@@ -192,29 +186,18 @@ AppWindowGeometryCache::WindowData::WindowData() |
AppWindowGeometryCache::WindowData::~WindowData() {} |
-void AppWindowGeometryCache::Observe( |
- int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
- switch (type) { |
- case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
- std::string extension_id = |
- content::Details<const extensions::Extension>(details).ptr()->id(); |
- LoadGeometryFromStorage(extension_id); |
- break; |
- } |
- case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
- std::string extension_id = |
- content::Details<const extensions::UnloadedExtensionInfo>(details) |
- .ptr() |
- ->extension->id(); |
- OnExtensionUnloaded(extension_id); |
- break; |
- } |
- default: |
- NOTREACHED(); |
- return; |
- } |
+void AppWindowGeometryCache::OnExtensionLoaded( |
+ content::BrowserContext* browser_context, |
+ const extensions::Extension* extension) { |
+ LoadGeometryFromStorage(extension->id()); |
+} |
+ |
+void AppWindowGeometryCache::OnExtensionUnloaded( |
+ content::BrowserContext* browser_context, |
+ const extensions::Extension* extension, |
+ extensions::UnloadedExtensionInfo::Reason reason) { |
+ SyncToStorage(); |
+ cache_.erase(extension->id()); |
} |
void AppWindowGeometryCache::SetSyncDelayForTests(int timeout_ms) { |
@@ -274,12 +257,6 @@ void AppWindowGeometryCache::LoadGeometryFromStorage( |
} |
} |
-void AppWindowGeometryCache::OnExtensionUnloaded( |
- const std::string& extension_id) { |
- SyncToStorage(); |
- cache_.erase(extension_id); |
-} |
- |
/////////////////////////////////////////////////////////////////////////////// |
// Factory boilerplate |