Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSION_SPEECH_INPUT_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_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 #include "content/common/notification_service.h" | 10 #include "content/common/notification_service.h" |
| 11 | 11 |
| 12 class ExtensionSpeechInputManager; | 12 class ExtensionSpeechInputManager; |
| 13 | 13 |
| 14 // Handles asynchronous operations such as starting or stopping speech | 14 // Handles asynchronous operations such as starting or stopping speech |
| 15 // recognition in the framework of the extension API state machine. | 15 // recognition in the framework of the extension API state machine. |
| 16 class SpeechInputAsyncFunction : public AsyncExtensionFunction, | 16 class SpeechInputAsyncFunction : public AsyncExtensionFunction, |
| 17 public NotificationObserver { | 17 public NotificationObserver { |
| 18 protected: | 18 protected: |
| 19 SpeechInputAsyncFunction(); | 19 SpeechInputAsyncFunction(); |
| 20 | 20 |
| 21 virtual void Run() OVERRIDE; | 21 virtual void Run() OVERRIDE; |
| 22 virtual bool RunImpl() = 0; | 22 virtual bool RunImpl() = 0; |
| 23 | 23 |
| 24 virtual int StartState() = 0; | |
|
Satish
2011/10/08 23:15:07
it may be simpler to define 4 const integers as me
Leandro GraciĆ” Gil
2011/10/09 10:29:21
Done.
| |
| 25 virtual int TransitionState() = 0; | |
| 26 virtual int EndState() = 0; | |
| 27 virtual int TransitionNotification() = 0; | |
| 28 | |
| 24 private: | 29 private: |
| 25 // NotificationObserver. | 30 // NotificationObserver. |
| 26 virtual void Observe(int type, | 31 virtual void Observe(int type, |
| 27 const NotificationSource& source, | 32 const NotificationSource& source, |
| 28 const NotificationDetails& details) OVERRIDE; | 33 const NotificationDetails& details) OVERRIDE; |
| 29 | 34 |
| 30 NotificationRegistrar registrar_; | 35 NotificationRegistrar registrar_; |
| 36 bool failed_; | |
| 31 }; | 37 }; |
| 32 | 38 |
| 33 // Implements experimental.speechInput.start. | 39 // Implements experimental.speechInput.start. |
| 34 class StartSpeechInputFunction : public SpeechInputAsyncFunction { | 40 class StartSpeechInputFunction : public SpeechInputAsyncFunction { |
| 35 protected: | 41 protected: |
| 36 virtual bool RunImpl() OVERRIDE; | 42 virtual bool RunImpl() OVERRIDE; |
| 37 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.start"); | 43 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.start"); |
| 44 | |
| 45 virtual int StartState() OVERRIDE; | |
| 46 virtual int TransitionState() OVERRIDE; | |
| 47 virtual int EndState() OVERRIDE; | |
| 48 virtual int TransitionNotification() OVERRIDE; | |
| 38 }; | 49 }; |
| 39 | 50 |
| 40 // Implements experimental.speechInput.stop. | 51 // Implements experimental.speechInput.stop. |
| 41 class StopSpeechInputFunction : public SpeechInputAsyncFunction { | 52 class StopSpeechInputFunction : public SpeechInputAsyncFunction { |
| 42 protected: | 53 protected: |
| 43 virtual bool RunImpl() OVERRIDE; | 54 virtual bool RunImpl() OVERRIDE; |
| 44 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.stop"); | 55 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.stop"); |
| 56 | |
| 57 virtual int StartState() OVERRIDE; | |
| 58 virtual int TransitionState() OVERRIDE; | |
| 59 virtual int EndState() OVERRIDE; | |
| 60 virtual int TransitionNotification() OVERRIDE; | |
| 45 }; | 61 }; |
| 46 | 62 |
| 47 // Implements experimental.speechInput.isRecording. | 63 // Implements experimental.speechInput.isRecording. |
| 48 class IsRecordingSpeechInputFunction : public SyncIOThreadExtensionFunction { | 64 class IsRecordingSpeechInputFunction : public SyncExtensionFunction { |
| 49 protected: | 65 protected: |
| 50 virtual bool RunImpl() OVERRIDE; | 66 virtual bool RunImpl() OVERRIDE; |
| 51 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.isRecording"); | 67 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.isRecording"); |
| 52 }; | 68 }; |
| 53 | 69 |
| 54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ | 70 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ |
| OLD | NEW |