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

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: browser_context_ 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..9e007517555986382b7147d0aa2c05a96fa24980 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)
+ : browser_context_(context) {}
virtual ~DefaultAlarmDelegate() {}
virtual void OnAlarm(const std::string& extension_id,
@@ -48,12 +49,13 @@ 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(
- extension_id, event.Pass());
+ ExtensionSystem::Get(browser_context_)
+ ->event_router()
+ ->DispatchEventToExtension(extension_id, event.Pass());
}
private:
- Profile* profile_;
+ content::BrowserContext* browser_context_;
};
// Creates a TimeDelta from a delay as specified in the API.
@@ -95,10 +97,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,
« no previous file with comments | « chrome/browser/extensions/api/alarms/alarm_manager.h ('k') | chrome/browser/extensions/api/api_resource_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698