| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/scoped_observer.h" | 17 #include "base/scoped_observer.h" |
| 18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 19 #include "extensions/browser/browser_context_keyed_api_factory.h" | 19 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 20 #include "extensions/browser/extension_registry_observer.h" | 20 #include "extensions/browser/extension_registry_observer.h" |
| 21 #include "extensions/common/api/alarms.h" | 21 #include "extensions/common/api/alarms.h" |
| 22 #include "extensions/common/extension_id.h" |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 class Clock; | 25 class Clock; |
| 25 } // namespace base | 26 } // namespace base |
| 26 | 27 |
| 27 namespace content { | 28 namespace content { |
| 28 class BrowserContext; | 29 class BrowserContext; |
| 29 } // namespace content | 30 } // namespace content |
| 30 | 31 |
| 31 namespace extensions { | 32 namespace extensions { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, TimerRunning); | 129 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, TimerRunning); |
| 129 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, MinimumGranularity); | 130 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, MinimumGranularity); |
| 130 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, | 131 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, |
| 131 DifferentMinimumGranularities); | 132 DifferentMinimumGranularities); |
| 132 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, | 133 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, |
| 133 RepeatingAlarmsScheduledPredictably); | 134 RepeatingAlarmsScheduledPredictably); |
| 134 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, | 135 FRIEND_TEST_ALL_PREFIXES(ExtensionAlarmsSchedulingTest, |
| 135 PollFrequencyFromStoredAlarm); | 136 PollFrequencyFromStoredAlarm); |
| 136 friend class BrowserContextKeyedAPIFactory<AlarmManager>; | 137 friend class BrowserContextKeyedAPIFactory<AlarmManager>; |
| 137 | 138 |
| 138 typedef std::string ExtensionId; | |
| 139 typedef std::map<ExtensionId, AlarmList> AlarmMap; | 139 typedef std::map<ExtensionId, AlarmList> AlarmMap; |
| 140 | 140 |
| 141 typedef base::Callback<void(const std::string&)> ReadyAction; | 141 typedef base::Callback<void(const std::string&)> ReadyAction; |
| 142 typedef std::queue<ReadyAction> ReadyQueue; | 142 typedef std::queue<ReadyAction> ReadyQueue; |
| 143 typedef std::map<ExtensionId, ReadyQueue> ReadyMap; | 143 typedef std::map<ExtensionId, ReadyQueue> ReadyMap; |
| 144 | 144 |
| 145 // Iterator used to identify a particular alarm within the Map/List pair. | 145 // Iterator used to identify a particular alarm within the Map/List pair. |
| 146 // "Not found" is represented by <alarms_.end(), invalid_iterator>. | 146 // "Not found" is represented by <alarms_.end(), invalid_iterator>. |
| 147 typedef std::pair<AlarmMap::iterator, AlarmList::iterator> AlarmIterator; | 147 typedef std::pair<AlarmMap::iterator, AlarmList::iterator> AlarmIterator; |
| 148 | 148 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 // Next poll's time. | 244 // Next poll's time. |
| 245 base::Time next_poll_time_; | 245 base::Time next_poll_time_; |
| 246 | 246 |
| 247 DISALLOW_COPY_AND_ASSIGN(AlarmManager); | 247 DISALLOW_COPY_AND_ASSIGN(AlarmManager); |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 } // namespace extensions | 250 } // namespace extensions |
| 251 | 251 |
| 252 #endif // EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ | 252 #endif // EXTENSIONS_BROWSER_API_ALARMS_ALARM_MANAGER_H_ |
| OLD | NEW |