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

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

Issue 10545104: Refactor chrome.alarms interface to support absolute alarm deadlines. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split create into createOneShot and createRepeating 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
Index: chrome/browser/extensions/api/alarms/alarms_api.h
diff --git a/chrome/browser/extensions/api/alarms/alarms_api.h b/chrome/browser/extensions/api/alarms/alarms_api.h
index eefe4b3849279d7ac36293676f51dde611982480..b074ed5caa99e9c6d26de33b4d830065372bec75 100644
--- a/chrome/browser/extensions/api/alarms/alarms_api.h
+++ b/chrome/browser/extensions/api/alarms/alarms_api.h
@@ -10,13 +10,34 @@
namespace extensions {
-class AlarmsCreateFunction : public SyncExtensionFunction {
+class AlarmsCreateOneShotFunction : public SyncExtensionFunction {
+ typedef base::Time (*TimeProvider)();
+ public:
+ AlarmsCreateOneShotFunction();
+ explicit AlarmsCreateOneShotFunction(TimeProvider now) : now_(now) {}
protected:
- virtual ~AlarmsCreateFunction() {}
+ virtual ~AlarmsCreateOneShotFunction() {}
// ExtensionFunction:
virtual bool RunImpl() OVERRIDE;
- DECLARE_EXTENSION_FUNCTION_NAME("alarms.create");
+ DECLARE_EXTENSION_FUNCTION_NAME("alarms.createOneShot");
+ private:
+ TimeProvider now_;
+};
+
+class AlarmsCreateRepeatingFunction : public SyncExtensionFunction {
+ typedef base::Time (*TimeProvider)();
+ public:
+ AlarmsCreateRepeatingFunction();
+ explicit AlarmsCreateRepeatingFunction(TimeProvider now) : now_(now) {}
+ protected:
+ virtual ~AlarmsCreateRepeatingFunction() {}
+
+ // ExtensionFunction:
+ virtual bool RunImpl() OVERRIDE;
+ DECLARE_EXTENSION_FUNCTION_NAME("alarms.createRepeating");
+ private:
+ TimeProvider now_;
};
class AlarmsGetFunction : public SyncExtensionFunction {

Powered by Google App Engine
This is Rietveld 408576698