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 #ifndef CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARM_MANAGER_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARM_MANAGER_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARM_MANAGER_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARM_MANAGER_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Internal helper to add an alarm and start the timer with the given delay. | 116 // Internal helper to add an alarm and start the timer with the given delay. |
117 void AddAlarmImpl(const std::string& extension_id, | 117 void AddAlarmImpl(const std::string& extension_id, |
118 const Alarm& alarm); | 118 const Alarm& alarm); |
119 | 119 |
120 // Syncs our alarm data for the given extension to/from the state storage. | 120 // Syncs our alarm data for the given extension to/from the state storage. |
121 void WriteToStorage(const std::string& extension_id); | 121 void WriteToStorage(const std::string& extension_id); |
122 void ReadFromStorage(const std::string& extension_id, | 122 void ReadFromStorage(const std::string& extension_id, |
123 scoped_ptr<base::Value> value); | 123 scoped_ptr<base::Value> value); |
124 | 124 |
125 // Schedules the next poll of alarms for when the next soonest alarm runs, | 125 // Schedules the next poll of alarms for when the next soonest alarm runs, |
126 // but do not more often than min_period. | 126 // but not more often than the minimum granularity of all alarms. |
127 void ScheduleNextPoll(base::TimeDelta min_period); | 127 void ScheduleNextPoll(); |
128 | 128 |
129 // Polls the alarms, running any that have elapsed. After running them and | 129 // Polls the alarms, running any that have elapsed. After running them and |
130 // rescheduling repeating alarms, schedule the next poll. | 130 // rescheduling repeating alarms, schedule the next poll. |
131 void PollAlarms(); | 131 void PollAlarms(); |
132 | 132 |
133 // NotificationObserver: | 133 // NotificationObserver: |
134 virtual void Observe(int type, | 134 virtual void Observe(int type, |
135 const content::NotificationSource& source, | 135 const content::NotificationSource& source, |
136 const content::NotificationDetails& details) OVERRIDE; | 136 const content::NotificationDetails& details) OVERRIDE; |
137 | 137 |
(...skipping 12 matching lines...) Expand all Loading... |
150 // The previous and next time that alarms were and will be run. | 150 // The previous and next time that alarms were and will be run. |
151 base::Time last_poll_time_; | 151 base::Time last_poll_time_; |
152 base::Time next_poll_time_; | 152 base::Time next_poll_time_; |
153 | 153 |
154 DISALLOW_COPY_AND_ASSIGN(AlarmManager); | 154 DISALLOW_COPY_AND_ASSIGN(AlarmManager); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace extensions | 157 } // namespace extensions |
158 | 158 |
159 #endif // CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARM_MANAGER_H__ | 159 #endif // CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARM_MANAGER_H__ |
OLD | NEW |