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

Side by Side Diff: chrome/browser/extensions/api/alarms/alarm_manager.cc

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/alarms/alarm_manager.h" 5 #include "chrome/browser/extensions/api/alarms/alarm_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return make_pair(list, it); 209 return make_pair(list, it);
210 } 210 }
211 211
212 return make_pair(alarms_.end(), AlarmList::iterator()); 212 return make_pair(alarms_.end(), AlarmList::iterator());
213 } 213 }
214 214
215 void AlarmManager::SetClockForTesting(base::Clock* clock) { 215 void AlarmManager::SetClockForTesting(base::Clock* clock) {
216 clock_.reset(clock); 216 clock_.reset(clock);
217 } 217 }
218 218
219 static base::LazyInstance<ProfileKeyedAPIFactory<AlarmManager> > 219 static base::LazyInstance<BrowserContextKeyedAPIFactory<AlarmManager> >
220 g_factory = LAZY_INSTANCE_INITIALIZER; 220 g_factory = LAZY_INSTANCE_INITIALIZER;
221 221
222 // static 222 // static
223 ProfileKeyedAPIFactory<AlarmManager>* AlarmManager::GetFactoryInstance() { 223 BrowserContextKeyedAPIFactory<AlarmManager>*
224 AlarmManager::GetFactoryInstance() {
224 return g_factory.Pointer(); 225 return g_factory.Pointer();
225 } 226 }
226 227
227 // static 228 // static
228 AlarmManager* AlarmManager::Get(Profile* profile) { 229 AlarmManager* AlarmManager::Get(Profile* profile) {
229 return ProfileKeyedAPIFactory<AlarmManager>::GetForProfile(profile); 230 return BrowserContextKeyedAPIFactory<AlarmManager>::Get(profile);
230 } 231 }
231 232
232 void AlarmManager::RemoveAlarmIterator(const AlarmIterator& iter) { 233 void AlarmManager::RemoveAlarmIterator(const AlarmIterator& iter) {
233 AlarmList& list = iter.first->second; 234 AlarmList& list = iter.first->second;
234 list.erase(iter.second); 235 list.erase(iter.second);
235 if (list.empty()) 236 if (list.empty())
236 alarms_.erase(iter.first); 237 alarms_.erase(iter.first);
237 238
238 // Cancel the timer if there are no more alarms. 239 // Cancel the timer if there are no more alarms.
239 // We don't need to reschedule the poll otherwise, because in 240 // We don't need to reschedule the poll otherwise, because in
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 if (create_info.period_in_minutes.get()) { 479 if (create_info.period_in_minutes.get()) {
479 js_alarm->period_in_minutes.reset( 480 js_alarm->period_in_minutes.reset(
480 new double(*create_info.period_in_minutes)); 481 new double(*create_info.period_in_minutes));
481 } 482 }
482 } 483 }
483 484
484 Alarm::~Alarm() { 485 Alarm::~Alarm() {
485 } 486 }
486 487
487 } // namespace extensions 488 } // namespace extensions
OLDNEW
« 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