Add ICU message format support
[chromium-blink-merge.git] / extensions / browser / api / alarms / alarms_api.h
blob837da909620d60d1051f2ff9ae8a810284e412ab
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_API_ALARMS_ALARMS_API_H_
6 #define EXTENSIONS_BROWSER_API_ALARMS_ALARMS_API_H_
8 #include <vector>
10 #include "extensions/browser/extension_function.h"
12 namespace base {
13 class Clock;
14 } // namespace base
16 namespace extensions {
17 struct Alarm;
18 typedef std::vector<Alarm> AlarmList;
20 class AlarmsCreateFunction : public AsyncExtensionFunction {
21 public:
22 AlarmsCreateFunction();
23 // Use |clock| instead of the default clock. Does not take ownership
24 // of |clock|. Used for testing.
25 explicit AlarmsCreateFunction(base::Clock* clock);
27 protected:
28 ~AlarmsCreateFunction() override;
30 // ExtensionFunction:
31 bool RunAsync() override;
32 DECLARE_EXTENSION_FUNCTION("alarms.create", ALARMS_CREATE)
33 private:
34 void Callback();
36 base::Clock* const clock_;
37 // Whether or not we own |clock_|. This is needed because we own it
38 // when we create it ourselves, but not when it's passed in for
39 // testing.
40 bool owns_clock_;
43 class AlarmsGetFunction : public AsyncExtensionFunction {
44 protected:
45 ~AlarmsGetFunction() override {}
47 // ExtensionFunction:
48 bool RunAsync() override;
50 private:
51 void Callback(const std::string& name, Alarm* alarm);
52 DECLARE_EXTENSION_FUNCTION("alarms.get", ALARMS_GET)
55 class AlarmsGetAllFunction : public AsyncExtensionFunction {
56 protected:
57 ~AlarmsGetAllFunction() override {}
59 // ExtensionFunction:
60 bool RunAsync() override;
62 private:
63 void Callback(const AlarmList* alarms);
64 DECLARE_EXTENSION_FUNCTION("alarms.getAll", ALARMS_GETALL)
67 class AlarmsClearFunction : public AsyncExtensionFunction {
68 protected:
69 ~AlarmsClearFunction() override {}
71 // ExtensionFunction:
72 bool RunAsync() override;
74 private:
75 void Callback(const std::string& name, bool success);
76 DECLARE_EXTENSION_FUNCTION("alarms.clear", ALARMS_CLEAR)
79 class AlarmsClearAllFunction : public AsyncExtensionFunction {
80 protected:
81 ~AlarmsClearAllFunction() override {}
83 // ExtensionFunction:
84 bool RunAsync() override;
86 private:
87 void Callback();
88 DECLARE_EXTENSION_FUNCTION("alarms.clearAll", ALARMS_CLEARALL)
91 } // namespace extensions
93 #endif // EXTENSIONS_BROWSER_API_ALARMS_ALARMS_API_H_