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

Unified Diff: chrome/browser/extensions/api/alarms/alarm_manager.cc

Issue 171813010: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 1). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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/alarms/alarm_manager.cc
diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.cc b/chrome/browser/extensions/api/alarms/alarm_manager.cc
index bec575c350ff871acd979cc6e658e89780ea7ac8..6f2aa5c3dfd1013017d6a2dce19dbacdb9a90f09 100644
--- a/chrome/browser/extensions/api/alarms/alarm_manager.cc
+++ b/chrome/browser/extensions/api/alarms/alarm_manager.cc
@@ -39,7 +39,8 @@ const base::TimeDelta kDefaultMinPollPeriod() {
class DefaultAlarmDelegate : public AlarmManager::Delegate {
public:
- explicit DefaultAlarmDelegate(Profile* profile) : profile_(profile) {}
+ explicit DefaultAlarmDelegate(content::BrowserContext* context)
+ : context_(context) {}
virtual ~DefaultAlarmDelegate() {}
virtual void OnAlarm(const std::string& extension_id,
@@ -48,12 +49,12 @@ class DefaultAlarmDelegate : public AlarmManager::Delegate {
args->Append(alarm.js_alarm->ToValue().release());
scoped_ptr<Event> event(new Event(alarms::OnAlarm::kEventName,
args.Pass()));
- ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
+ ExtensionSystem::Get(context_)->event_router()->DispatchEventToExtension(
extension_id, event.Pass());
}
private:
- Profile* profile_;
+ content::BrowserContext* context_;
};
// Creates a TimeDelta from a delay as specified in the API.
@@ -95,10 +96,10 @@ scoped_ptr<base::ListValue> AlarmsToValue(const std::vector<Alarm>& alarms) {
// AlarmManager
-AlarmManager::AlarmManager(Profile* profile)
- : profile_(profile),
+AlarmManager::AlarmManager(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)),
clock_(new base::DefaultClock()),
- delegate_(new DefaultAlarmDelegate(profile)) {
+ delegate_(new DefaultAlarmDelegate(context)) {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,

Powered by Google App Engine
This is Rietveld 408576698