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 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 AlarmsCreateFunction : public SyncExtensionFunction { |
| 14 typedef base::Time (*TimeProvider)(); |
| 15 public: |
| 16 AlarmsCreateFunction(); |
| 17 explicit AlarmsCreateFunction(TimeProvider now) : now_(now) {} |
14 protected: | 18 protected: |
15 virtual ~AlarmsCreateFunction() {} | 19 virtual ~AlarmsCreateFunction() {} |
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.create"); |
| 24 private: |
| 25 TimeProvider now_; |
20 }; | 26 }; |
21 | 27 |
22 class AlarmsGetFunction : public SyncExtensionFunction { | 28 class AlarmsGetFunction : public SyncExtensionFunction { |
23 protected: | 29 protected: |
24 virtual ~AlarmsGetFunction() {} | 30 virtual ~AlarmsGetFunction() {} |
25 | 31 |
26 // ExtensionFunction: | 32 // ExtensionFunction: |
27 virtual bool RunImpl() OVERRIDE; | 33 virtual bool RunImpl() OVERRIDE; |
28 DECLARE_EXTENSION_FUNCTION_NAME("alarms.get"); | 34 DECLARE_EXTENSION_FUNCTION_NAME("alarms.get"); |
29 }; | 35 }; |
(...skipping 21 matching lines...) Expand all Loading... |
51 virtual ~AlarmsClearAllFunction() {} | 57 virtual ~AlarmsClearAllFunction() {} |
52 | 58 |
53 // ExtensionFunction: | 59 // ExtensionFunction: |
54 virtual bool RunImpl() OVERRIDE; | 60 virtual bool RunImpl() OVERRIDE; |
55 DECLARE_EXTENSION_FUNCTION_NAME("alarms.clearAll"); | 61 DECLARE_EXTENSION_FUNCTION_NAME("alarms.clearAll"); |
56 }; | 62 }; |
57 | 63 |
58 } // namespace extensions | 64 } // namespace extensions |
59 | 65 |
60 #endif // CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARMS_API_H__ | 66 #endif // CHROME_BROWSER_EXTENSIONS_API_ALARMS_ALARMS_API_H__ |
OLD | NEW |