1 // Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_
8 #include "base/prefs/pref_change_registrar.h"
9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
11 #include "chrome/browser/extensions/chrome_extension_function.h"
12 #include "chrome/common/extensions/api/hotword_private.h"
16 namespace extensions {
18 // Listens for changes in disable/enabled state and forwards as an extension
20 class HotwordPrivateEventService : public ProfileKeyedAPI {
22 explicit HotwordPrivateEventService(Profile* profile);
23 virtual ~HotwordPrivateEventService();
25 // ProfileKeyedAPI implementation.
26 virtual void Shutdown() OVERRIDE;
27 static ProfileKeyedAPIFactory<HotwordPrivateEventService>*
29 static const char* service_name();
31 void OnEnabledChanged(const std::string& pref_name);
34 friend class ProfileKeyedAPIFactory<HotwordPrivateEventService>;
39 PrefChangeRegistrar pref_change_registrar_;
43 class HotwordPrivateSetEnabledFunction : public ChromeSyncExtensionFunction {
45 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setEnabled",
46 HOTWORDPRIVATE_SETENABLED)
49 virtual ~HotwordPrivateSetEnabledFunction() {}
52 virtual bool RunImpl() OVERRIDE;
55 class HotwordPrivateGetStatusFunction : public ChromeSyncExtensionFunction {
57 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.getStatus",
58 HOTWORDPRIVATE_GETSTATUS)
61 virtual ~HotwordPrivateGetStatusFunction() {}
64 virtual bool RunImpl() OVERRIDE;
67 } // namespace extensions
69 #endif // CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_