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

Unified Diff: chrome/browser/extensions/api/alarms/alarm_manager.h

Issue 10545128: Unrevert r141537: Add extensions::StateStore and use that instead of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix.crash Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/value_conversions.cc ('k') | chrome/browser/extensions/api/alarms/alarm_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/alarms/alarm_manager.h
diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.h b/chrome/browser/extensions/api/alarms/alarm_manager.h
index 47884f9ece729fd5ae7957981029f7d04418f13b..6930998c2075e505d2cef7adedae5715811e8755 100644
--- a/chrome/browser/extensions/api/alarms/alarm_manager.h
+++ b/chrome/browser/extensions/api/alarms/alarm_manager.h
@@ -10,6 +10,7 @@
#include <map>
#include <vector>
+#include "base/memory/weak_ptr.h"
#include "base/timer.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/common/extensions/api/alarms.h"
@@ -24,7 +25,9 @@ class ExtensionAlarmsSchedulingTest;
// Manages the currently pending alarms for every extension in a profile.
// There is one manager per virtual Profile.
-class AlarmManager : public content::NotificationObserver {
+class AlarmManager
+ : public content::NotificationObserver,
+ public base::SupportsWeakPtr<AlarmManager> {
public:
typedef extensions::api::alarms::Alarm Alarm;
typedef std::vector<linked_ptr<Alarm> > AlarmList;
@@ -100,9 +103,10 @@ class AlarmManager : public content::NotificationObserver {
const linked_ptr<Alarm>& alarm,
base::TimeDelta time_delay);
- // Syncs our alarm data for the given extension to/from the prefs file.
- void WriteToPrefs(const std::string& extension_id);
- void ReadFromPrefs(const std::string& extension_id);
+ // Syncs our alarm data for the given extension to/from the state storage.
+ void WriteToStorage(const std::string& extension_id);
+ void ReadFromStorage(const std::string& extension_id,
+ scoped_ptr<base::Value> value);
// Schedules the next poll of alarms for when the next soonest alarm runs,
// but do not more often than min_period.
@@ -135,15 +139,6 @@ class AlarmManager : public content::NotificationObserver {
base::Time next_poll_time_;
};
-// Contains the data we store in the extension prefs for each alarm.
-struct AlarmPref {
- linked_ptr<AlarmManager::Alarm> alarm;
- base::Time scheduled_run_time;
-
- AlarmPref();
- ~AlarmPref();
-};
-
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARM_MANAGER_H__
« no previous file with comments | « base/value_conversions.cc ('k') | chrome/browser/extensions/api/alarms/alarm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698