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

Unified Diff: chrome/browser/extensions/api/idle/idle_manager.h

Issue 275383002: Use ExtensionRegistryObserver instead of deprecated extension notification from c/b/e/api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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/api/idle/idle_manager.h
diff --git a/chrome/browser/extensions/api/idle/idle_manager.h b/chrome/browser/extensions/api/idle/idle_manager.h
index e93b0b23248668f809ac6df46de785ed97d50635..4752917ecd840ff50946912ff73688c4ff39a498 100644
--- a/chrome/browser/extensions/api/idle/idle_manager.h
+++ b/chrome/browser/extensions/api/idle/idle_manager.h
@@ -11,13 +11,13 @@
#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "chrome/browser/idle.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/event_router.h"
+#include "extensions/browser/extension_registry_observer.h"
namespace base {
class StringValue;
@@ -26,6 +26,7 @@ class StringValue;
class Profile;
namespace extensions {
+class ExtensionRegistry;
typedef base::Callback<void(IdleState)> QueryStateCallback;
@@ -37,7 +38,7 @@ struct IdleMonitor {
int threshold;
};
-class IdleManager : public content::NotificationObserver,
+class IdleManager : public ExtensionRegistryObserver,
public EventRouter::Observer,
public KeyedService {
public:
@@ -75,10 +76,11 @@ class IdleManager : public content::NotificationObserver,
// KeyedService implementation.
virtual void Shutdown() OVERRIDE;
- // content::NotificationDelegate implementation.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
// EventRouter::Observer implementation.
virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE;
@@ -125,13 +127,16 @@ class IdleManager : public content::NotificationObserver,
base::RepeatingTimer<IdleManager> poll_timer_;
base::WeakPtrFactory<IdleManager> weak_factory_;
- content::NotificationRegistrar registrar_;
scoped_ptr<IdleTimeProvider> idle_time_provider_;
scoped_ptr<EventDelegate> event_delegate_;
base::ThreadChecker thread_checker_;
+ // Listen to extension unloaded notification.
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
DISALLOW_COPY_AND_ASSIGN(IdleManager);
};

Powered by Google App Engine
This is Rietveld 408576698