| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "chrome/browser/extensions/extension_function.h" | |
| 10 #include "content/common/notification_service.h" | |
| 11 | |
| 12 class ExtensionSpeechInputManager; | |
| 13 | |
| 14 // Handles asynchronous operations such as starting or stopping speech | |
| 15 // recognition in the framework of the extension API state machine. | |
| 16 class SpeechInputAsyncFunction : public AsyncExtensionFunction, | |
| 17 public NotificationObserver { | |
| 18 protected: | |
| 19 SpeechInputAsyncFunction(); | |
| 20 | |
| 21 virtual void Run() OVERRIDE; | |
| 22 virtual bool RunImpl() = 0; | |
| 23 | |
| 24 private: | |
| 25 // NotificationObserver. | |
| 26 virtual void Observe(int type, | |
| 27 const NotificationSource& source, | |
| 28 const NotificationDetails& details) OVERRIDE; | |
| 29 | |
| 30 NotificationRegistrar registrar_; | |
| 31 }; | |
| 32 | |
| 33 // Implements experimental.speechInput.start. | |
| 34 class StartSpeechInputFunction : public SpeechInputAsyncFunction { | |
| 35 protected: | |
| 36 virtual bool RunImpl() OVERRIDE; | |
| 37 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.start"); | |
| 38 }; | |
| 39 | |
| 40 // Implements experimental.speechInput.stop. | |
| 41 class StopSpeechInputFunction : public SpeechInputAsyncFunction { | |
| 42 protected: | |
| 43 virtual bool RunImpl() OVERRIDE; | |
| 44 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.stop"); | |
| 45 }; | |
| 46 | |
| 47 // Implements experimental.speechInput.isRecording. | |
| 48 class IsRecordingSpeechInputFunction : public SyncIOThreadExtensionFunction { | |
| 49 protected: | |
| 50 virtual bool RunImpl() OVERRIDE; | |
| 51 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.isRecording"); | |
| 52 }; | |
| 53 | |
| 54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ | |
| OLD | NEW |