| Index: apps/app_window_geometry_cache.h
|
| diff --git a/apps/app_window_geometry_cache.h b/apps/app_window_geometry_cache.h
|
| index 20764284b7f611dc54c367e3a44cbb40d2cdc66f..8813eea2b08156be6131e370d4e9dbc87fa42468 100644
|
| --- a/apps/app_window_geometry_cache.h
|
| +++ b/apps/app_window_geometry_cache.h
|
| @@ -12,13 +12,13 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/singleton.h"
|
| #include "base/observer_list.h"
|
| +#include "base/scoped_observer.h"
|
| #include "base/time/time.h"
|
| #include "base/timer/timer.h"
|
| #include "base/values.h"
|
| #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
|
| #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 "ui/base/ui_base_types.h"
|
| #include "ui/gfx/rect.h"
|
|
|
| @@ -26,6 +26,7 @@ class Profile;
|
|
|
| namespace extensions {
|
| class ExtensionPrefs;
|
| +class ExtensionRegistry;
|
| }
|
|
|
| namespace apps {
|
| @@ -34,7 +35,7 @@ namespace apps {
|
| // for IO when creating a new window, and to not cause IO on every window
|
| // geometry change.
|
| class AppWindowGeometryCache : public KeyedService,
|
| - public content::NotificationObserver {
|
| + public extensions::ExtensionRegistryObserver {
|
| public:
|
| class Factory : public BrowserContextKeyedServiceFactory {
|
| public:
|
| @@ -122,31 +123,38 @@ class AppWindowGeometryCache : public KeyedService,
|
| // Data stored for each extension.
|
| typedef std::map<std::string, WindowData> ExtensionData;
|
|
|
| - // content::NotificationObserver
|
| - virtual void Observe(int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) OVERRIDE;
|
| + // ExtensionRegistryObserver implementation.
|
| + virtual void OnExtensionLoaded(
|
| + content::BrowserContext* browser_context,
|
| + const extensions::Extension* extension) OVERRIDE;
|
| + virtual void OnExtensionUnloaded(
|
| + content::BrowserContext* browser_context,
|
| + const extensions::Extension* extension,
|
| + extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
|
|
|
| void LoadGeometryFromStorage(const std::string& extension_id);
|
| - void OnExtensionUnloaded(const std::string& extension_id);
|
| void SyncToStorage();
|
|
|
| // Preferences storage.
|
| extensions::ExtensionPrefs* prefs_;
|
|
|
| - // Cached data
|
| + // Cached data.
|
| std::map<std::string, ExtensionData> cache_;
|
|
|
| - // Data that still needs saving
|
| + // Data that still needs saving.
|
| std::set<std::string> unsynced_extensions_;
|
|
|
| - // The timer used to save the data
|
| + // The timer used to save the data.
|
| base::OneShotTimer<AppWindowGeometryCache> sync_timer_;
|
|
|
| // The timeout value we'll use for |sync_timer_|.
|
| base::TimeDelta sync_delay_;
|
|
|
| - content::NotificationRegistrar registrar_;
|
| + // Listen to extension load, unloaded notifications.
|
| + ScopedObserver<extensions::ExtensionRegistry,
|
| + extensions::ExtensionRegistryObserver>
|
| + extension_registry_observer_;
|
| +
|
| ObserverList<Observer> observers_;
|
| };
|
|
|
|
|