| OLD | NEW |
| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 void AlarmManager::SetClockForTesting(base::Clock* clock) { | 213 void AlarmManager::SetClockForTesting(base::Clock* clock) { |
| 214 clock_.reset(clock); | 214 clock_.reset(clock); |
| 215 } | 215 } |
| 216 | 216 |
| 217 static base::LazyInstance<ProfileKeyedAPIFactory<AlarmManager> > | 217 static base::LazyInstance<ProfileKeyedAPIFactory<AlarmManager> > |
| 218 g_factory = LAZY_INSTANCE_INITIALIZER; | 218 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 219 | 219 |
| 220 // static | 220 // static |
| 221 ProfileKeyedAPIFactory<AlarmManager>* AlarmManager::GetFactoryInstance() { | 221 ProfileKeyedAPIFactory<AlarmManager>* AlarmManager::GetFactoryInstance() { |
| 222 return &g_factory.Get(); | 222 return g_factory.Pointer(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 // static | 225 // static |
| 226 AlarmManager* AlarmManager::Get(Profile* profile) { | 226 AlarmManager* AlarmManager::Get(Profile* profile) { |
| 227 return ProfileKeyedAPIFactory<AlarmManager>::GetForProfile(profile); | 227 return ProfileKeyedAPIFactory<AlarmManager>::GetForProfile(profile); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void AlarmManager::RemoveAlarmIterator(const AlarmIterator& iter) { | 230 void AlarmManager::RemoveAlarmIterator(const AlarmIterator& iter) { |
| 231 AlarmList& list = iter.first->second; | 231 AlarmList& list = iter.first->second; |
| 232 list.erase(iter.second); | 232 list.erase(iter.second); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 if (create_info.period_in_minutes.get()) { | 461 if (create_info.period_in_minutes.get()) { |
| 462 js_alarm->period_in_minutes.reset( | 462 js_alarm->period_in_minutes.reset( |
| 463 new double(*create_info.period_in_minutes)); | 463 new double(*create_info.period_in_minutes)); |
| 464 } | 464 } |
| 465 } | 465 } |
| 466 | 466 |
| 467 Alarm::~Alarm() { | 467 Alarm::~Alarm() { |
| 468 } | 468 } |
| 469 | 469 |
| 470 } // namespace extensions | 470 } // namespace extensions |
| OLD | NEW |