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 EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 16 matching lines...) Expand all Loading... |
27 class BrowserContext; | 27 class BrowserContext; |
28 } // namespace content | 28 } // namespace content |
29 | 29 |
30 namespace extensions { | 30 namespace extensions { |
31 class ExtensionAlarmsSchedulingTest; | 31 class ExtensionAlarmsSchedulingTest; |
32 class ExtensionRegistry; | 32 class ExtensionRegistry; |
33 | 33 |
34 struct Alarm { | 34 struct Alarm { |
35 Alarm(); | 35 Alarm(); |
36 Alarm(const std::string& name, | 36 Alarm(const std::string& name, |
37 const core_api::alarms::AlarmCreateInfo& create_info, | 37 const api::alarms::AlarmCreateInfo& create_info, |
38 base::TimeDelta min_granularity, | 38 base::TimeDelta min_granularity, |
39 base::Time now); | 39 base::Time now); |
40 ~Alarm(); | 40 ~Alarm(); |
41 | 41 |
42 linked_ptr<core_api::alarms::Alarm> js_alarm; | 42 linked_ptr<api::alarms::Alarm> js_alarm; |
43 // The granularity isn't exposed to the extension's javascript, but we poll at | 43 // The granularity isn't exposed to the extension's javascript, but we poll at |
44 // least as often as the shortest alarm's granularity. It's initialized as | 44 // least as often as the shortest alarm's granularity. It's initialized as |
45 // the relative delay requested in creation, even if creation uses an absolute | 45 // the relative delay requested in creation, even if creation uses an absolute |
46 // time. This will always be at least as large as the min_granularity | 46 // time. This will always be at least as large as the min_granularity |
47 // constructor argument. | 47 // constructor argument. |
48 base::TimeDelta granularity; | 48 base::TimeDelta granularity; |
49 // The minimum granularity is the minimum allowed polling rate. This stops | 49 // The minimum granularity is the minimum allowed polling rate. This stops |
50 // alarms from polling too often. | 50 // alarms from polling too often. |
51 base::TimeDelta minimum_granularity; | 51 base::TimeDelta minimum_granularity; |
52 }; | 52 }; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 // Next poll's time. | 236 // Next poll's time. |
237 base::Time next_poll_time_; | 237 base::Time next_poll_time_; |
238 | 238 |
239 DISALLOW_COPY_AND_ASSIGN(AlarmManager); | 239 DISALLOW_COPY_AND_ASSIGN(AlarmManager); |
240 }; | 240 }; |
241 | 241 |
242 } // namespace extensions | 242 } // namespace extensions |
243 | 243 |
244 #endif // EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ | 244 #endif // EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ |
OLD | NEW |