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

Unified Diff: chrome/browser/extensions/api/alarms/alarm_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: address review 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/alarms/alarm_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/alarms/alarm_manager.h
diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.h b/chrome/browser/extensions/api/alarms/alarm_manager.h
index 04515f10a2b941a6c40fe3b8d2a73fc863be1a86..95cfabcb66c793a9c7b1221720aa6a01305a9cca 100644
--- a/chrome/browser/extensions/api/alarms/alarm_manager.h
+++ b/chrome/browser/extensions/api/alarms/alarm_manager.h
@@ -12,14 +12,14 @@
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
#include "base/timer/timer.h"
#include "chrome/common/extensions/api/alarms.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_function.h"
-
-class Profile;
+#include "extensions/browser/extension_registry_observer.h"
namespace base {
class Clock;
@@ -30,8 +30,8 @@ class BrowserContext;
} // namespace content
namespace extensions {
-
class ExtensionAlarmsSchedulingTest;
+class ExtensionRegistry;
struct Alarm {
Alarm();
@@ -57,6 +57,7 @@ struct Alarm {
// There is one manager per virtual Profile.
class AlarmManager : public BrowserContextKeyedAPI,
public content::NotificationObserver,
+ public ExtensionRegistryObserver,
public base::SupportsWeakPtr<AlarmManager> {
public:
typedef std::vector<Alarm> AlarmList;
@@ -114,8 +115,8 @@ class AlarmManager : public BrowserContextKeyedAPI,
// BrowserContextKeyedAPI implementation.
static BrowserContextKeyedAPIFactory<AlarmManager>* GetFactoryInstance();
- // Convenience method to get the AlarmManager for a profile.
- static AlarmManager* Get(Profile* profile);
+ // Convenience method to get the AlarmManager for a content::BrowserContext.
+ static AlarmManager* Get(content::BrowserContext* browser_context);
private:
friend void RunScheduleNextPoll(AlarmManager*);
@@ -208,17 +209,25 @@ class AlarmManager : public BrowserContextKeyedAPI,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Overridden from extensions::ExtensionRegistryObserver.
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+
// BrowserContextKeyedAPI implementation.
static const char* service_name() {
return "AlarmManager";
}
static const bool kServiceHasOwnInstanceInIncognito = true;
- Profile* const profile_;
+ content::BrowserContext* const browser_context_;
scoped_ptr<base::Clock> clock_;
content::NotificationRegistrar registrar_;
scoped_ptr<Delegate> delegate_;
+ // Listen to extension load notifications.
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
// The timer for this alarm manager.
base::OneShotTimer<AlarmManager> timer_;
« no previous file with comments | « no previous file | chrome/browser/extensions/api/alarms/alarm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698