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

Side by Side 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: Rename timeToFire to time 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_ALARMS_API_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARMS_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARMS_API_H__ 6 #define CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARMS_API_H__
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/extension_function.h" 9 #include "chrome/browser/extensions/extension_function.h"
10 10
11 namespace extensions { 11 namespace extensions {
12 12
13 class AlarmsCreateFunction : public SyncExtensionFunction { 13 class AlarmsCreateOneShotFunction : public SyncExtensionFunction {
14 typedef base::Time (*TimeProvider)();
15 public:
16 AlarmsCreateOneShotFunction();
17 explicit AlarmsCreateOneShotFunction(TimeProvider now) : now_(now) {}
14 protected: 18 protected:
15 virtual ~AlarmsCreateFunction() {} 19 virtual ~AlarmsCreateOneShotFunction() {}
16 20
17 // ExtensionFunction: 21 // ExtensionFunction:
18 virtual bool RunImpl() OVERRIDE; 22 virtual bool RunImpl() OVERRIDE;
19 DECLARE_EXTENSION_FUNCTION_NAME("alarms.create"); 23 DECLARE_EXTENSION_FUNCTION_NAME("alarms.createOneShot");
24 private:
25 TimeProvider now_;
26 };
27
28 class AlarmsCreateRepeatingFunction : public SyncExtensionFunction {
29 typedef base::Time (*TimeProvider)();
30 public:
31 AlarmsCreateRepeatingFunction();
32 explicit AlarmsCreateRepeatingFunction(TimeProvider now) : now_(now) {}
33 protected:
34 virtual ~AlarmsCreateRepeatingFunction() {}
35
36 // ExtensionFunction:
37 virtual bool RunImpl() OVERRIDE;
38 DECLARE_EXTENSION_FUNCTION_NAME("alarms.createRepeating");
39 private:
40 TimeProvider now_;
20 }; 41 };
21 42
22 class AlarmsGetFunction : public SyncExtensionFunction { 43 class AlarmsGetFunction : public SyncExtensionFunction {
23 protected: 44 protected:
24 virtual ~AlarmsGetFunction() {} 45 virtual ~AlarmsGetFunction() {}
25 46
26 // ExtensionFunction: 47 // ExtensionFunction:
27 virtual bool RunImpl() OVERRIDE; 48 virtual bool RunImpl() OVERRIDE;
28 DECLARE_EXTENSION_FUNCTION_NAME("alarms.get"); 49 DECLARE_EXTENSION_FUNCTION_NAME("alarms.get");
29 }; 50 };
(...skipping 21 matching lines...) Expand all
51 virtual ~AlarmsClearAllFunction() {} 72 virtual ~AlarmsClearAllFunction() {}
52 73
53 // ExtensionFunction: 74 // ExtensionFunction:
54 virtual bool RunImpl() OVERRIDE; 75 virtual bool RunImpl() OVERRIDE;
55 DECLARE_EXTENSION_FUNCTION_NAME("alarms.clearAll"); 76 DECLARE_EXTENSION_FUNCTION_NAME("alarms.clearAll");
56 }; 77 };
57 78
58 } // namespace extensions 79 } // namespace extensions
59 80
60 #endif // CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARMS_API_H__ 81 #endif // CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARMS_API_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698