| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_ |
| 7 | 7 |
| 8 #include "base/prefs/pref_change_registrar.h" | 8 #include "base/prefs/pref_change_registrar.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 11 #include "chrome/common/extensions/api/hotword_private.h" | 11 #include "chrome/common/extensions/api/hotword_private.h" |
| 12 #include "extensions/browser/browser_context_keyed_api_factory.h" | 12 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 13 | 13 |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // Listens for changes in disable/enabled state and forwards as an extension | 18 // Listens for changes in disable/enabled state and forwards as an extension |
| 19 // event. | 19 // event. |
| 20 class HotwordPrivateEventService : public BrowserContextKeyedAPI { | 20 class HotwordPrivateEventService : public BrowserContextKeyedAPI { |
| 21 public: | 21 public: |
| 22 explicit HotwordPrivateEventService(content::BrowserContext* context); | 22 explicit HotwordPrivateEventService(content::BrowserContext* context); |
| 23 virtual ~HotwordPrivateEventService(); | 23 virtual ~HotwordPrivateEventService(); |
| 24 | 24 |
| 25 // BrowserContextKeyedAPI implementation. | 25 // BrowserContextKeyedAPI implementation. |
| 26 virtual void Shutdown() OVERRIDE; | 26 virtual void Shutdown() override; |
| 27 static BrowserContextKeyedAPIFactory<HotwordPrivateEventService>* | 27 static BrowserContextKeyedAPIFactory<HotwordPrivateEventService>* |
| 28 GetFactoryInstance(); | 28 GetFactoryInstance(); |
| 29 static const char* service_name(); | 29 static const char* service_name(); |
| 30 | 30 |
| 31 void OnEnabledChanged(const std::string& pref_name); | 31 void OnEnabledChanged(const std::string& pref_name); |
| 32 | 32 |
| 33 void OnHotwordSessionRequested(); | 33 void OnHotwordSessionRequested(); |
| 34 | 34 |
| 35 void OnHotwordSessionStopped(); | 35 void OnHotwordSessionStopped(); |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 friend class BrowserContextKeyedAPIFactory<HotwordPrivateEventService>; | 38 friend class BrowserContextKeyedAPIFactory<HotwordPrivateEventService>; |
| 39 | 39 |
| 40 void SignalEvent(const std::string& event_name); | 40 void SignalEvent(const std::string& event_name); |
| 41 | 41 |
| 42 Profile* profile_; | 42 Profile* profile_; |
| 43 PrefChangeRegistrar pref_change_registrar_; | 43 PrefChangeRegistrar pref_change_registrar_; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 | 46 |
| 47 class HotwordPrivateSetEnabledFunction : public ChromeSyncExtensionFunction { | 47 class HotwordPrivateSetEnabledFunction : public ChromeSyncExtensionFunction { |
| 48 public: | 48 public: |
| 49 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setEnabled", | 49 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setEnabled", |
| 50 HOTWORDPRIVATE_SETENABLED) | 50 HOTWORDPRIVATE_SETENABLED) |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 virtual ~HotwordPrivateSetEnabledFunction() {} | 53 virtual ~HotwordPrivateSetEnabledFunction() {} |
| 54 | 54 |
| 55 // ExtensionFunction: | 55 // ExtensionFunction: |
| 56 virtual bool RunSync() OVERRIDE; | 56 virtual bool RunSync() override; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class HotwordPrivateSetAudioLoggingEnabledFunction | 59 class HotwordPrivateSetAudioLoggingEnabledFunction |
| 60 : public ChromeSyncExtensionFunction { | 60 : public ChromeSyncExtensionFunction { |
| 61 public: | 61 public: |
| 62 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setAudioLoggingEnabled", | 62 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setAudioLoggingEnabled", |
| 63 HOTWORDPRIVATE_SETAUDIOLOGGINGENABLED) | 63 HOTWORDPRIVATE_SETAUDIOLOGGINGENABLED) |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 virtual ~HotwordPrivateSetAudioLoggingEnabledFunction() {} | 66 virtual ~HotwordPrivateSetAudioLoggingEnabledFunction() {} |
| 67 | 67 |
| 68 // ExtensionFunction: | 68 // ExtensionFunction: |
| 69 virtual bool RunSync() OVERRIDE; | 69 virtual bool RunSync() override; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class HotwordPrivateSetHotwordAlwaysOnSearchEnabledFunction | 72 class HotwordPrivateSetHotwordAlwaysOnSearchEnabledFunction |
| 73 : public ChromeSyncExtensionFunction { | 73 : public ChromeSyncExtensionFunction { |
| 74 public: | 74 public: |
| 75 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setHotwordAlwaysOnSearchEnabled", | 75 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setHotwordAlwaysOnSearchEnabled", |
| 76 HOTWORDPRIVATE_SETHOTWORDALWAYSONSEARCHENABLED) | 76 HOTWORDPRIVATE_SETHOTWORDALWAYSONSEARCHENABLED) |
| 77 | 77 |
| 78 protected: | 78 protected: |
| 79 virtual ~HotwordPrivateSetHotwordAlwaysOnSearchEnabledFunction() {} | 79 virtual ~HotwordPrivateSetHotwordAlwaysOnSearchEnabledFunction() {} |
| 80 | 80 |
| 81 // ExtensionFunction: | 81 // ExtensionFunction: |
| 82 virtual bool RunSync() OVERRIDE; | 82 virtual bool RunSync() override; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class HotwordPrivateGetStatusFunction : public ChromeSyncExtensionFunction { | 85 class HotwordPrivateGetStatusFunction : public ChromeSyncExtensionFunction { |
| 86 public: | 86 public: |
| 87 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.getStatus", | 87 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.getStatus", |
| 88 HOTWORDPRIVATE_GETSTATUS) | 88 HOTWORDPRIVATE_GETSTATUS) |
| 89 | 89 |
| 90 protected: | 90 protected: |
| 91 virtual ~HotwordPrivateGetStatusFunction() {} | 91 virtual ~HotwordPrivateGetStatusFunction() {} |
| 92 | 92 |
| 93 // ExtensionFunction: | 93 // ExtensionFunction: |
| 94 virtual bool RunSync() OVERRIDE; | 94 virtual bool RunSync() override; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 class HotwordPrivateSetHotwordSessionStateFunction | 97 class HotwordPrivateSetHotwordSessionStateFunction |
| 98 : public ChromeSyncExtensionFunction { | 98 : public ChromeSyncExtensionFunction { |
| 99 public: | 99 public: |
| 100 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setHotwordSessionState", | 100 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.setHotwordSessionState", |
| 101 HOTWORDPRIVATE_SETHOTWORDSESSIONSTATE); | 101 HOTWORDPRIVATE_SETHOTWORDSESSIONSTATE); |
| 102 | 102 |
| 103 protected: | 103 protected: |
| 104 virtual ~HotwordPrivateSetHotwordSessionStateFunction() {} | 104 virtual ~HotwordPrivateSetHotwordSessionStateFunction() {} |
| 105 | 105 |
| 106 // ExtensionFunction: | 106 // ExtensionFunction: |
| 107 virtual bool RunSync() OVERRIDE; | 107 virtual bool RunSync() override; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 class HotwordPrivateNotifyHotwordRecognitionFunction | 110 class HotwordPrivateNotifyHotwordRecognitionFunction |
| 111 : public ChromeSyncExtensionFunction { | 111 : public ChromeSyncExtensionFunction { |
| 112 public: | 112 public: |
| 113 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.notifyHotwordRecognition", | 113 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.notifyHotwordRecognition", |
| 114 HOTWORDPRIVATE_NOTIFYHOTWORDRECOGNITION); | 114 HOTWORDPRIVATE_NOTIFYHOTWORDRECOGNITION); |
| 115 | 115 |
| 116 protected: | 116 protected: |
| 117 virtual ~HotwordPrivateNotifyHotwordRecognitionFunction() {} | 117 virtual ~HotwordPrivateNotifyHotwordRecognitionFunction() {} |
| 118 | 118 |
| 119 // ExtensionFunction: | 119 // ExtensionFunction: |
| 120 virtual bool RunSync() OVERRIDE; | 120 virtual bool RunSync() override; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 class HotwordPrivateGetLaunchStateFunction : | 123 class HotwordPrivateGetLaunchStateFunction : |
| 124 public ChromeSyncExtensionFunction { | 124 public ChromeSyncExtensionFunction { |
| 125 public: | 125 public: |
| 126 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.getLaunchState", | 126 DECLARE_EXTENSION_FUNCTION("hotwordPrivate.getLaunchState", |
| 127 HOTWORDPRIVATE_GETLAUNCHSTATE) | 127 HOTWORDPRIVATE_GETLAUNCHSTATE) |
| 128 | 128 |
| 129 protected: | 129 protected: |
| 130 virtual ~HotwordPrivateGetLaunchStateFunction() {} | 130 virtual ~HotwordPrivateGetLaunchStateFunction() {} |
| 131 | 131 |
| 132 // ExtensionFunction: | 132 // ExtensionFunction: |
| 133 virtual bool RunSync() OVERRIDE; | 133 virtual bool RunSync() override; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace extensions | 136 } // namespace extensions |
| 137 | 137 |
| 138 #endif // CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_ | 138 #endif // CHROME_BROWSER_EXTENSIONS_API_HOTWORD_PRIVATE_HOTWORD_PRIVATE_API_H_ |
| OLD | NEW |