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(int start_state, int transition_state, |
| 20 int end_state, int transition_notification); | |
|
Satish
2011/10/09 20:01:47
parameters should either be on the same line or al
Leandro Graciá Gil
2011/10/10 18:59:38
Done.
| |
| 21 virtual ~SpeechInputAsyncFunction(); | |
| 20 | 22 |
| 21 virtual void Run() OVERRIDE; | 23 virtual void Run() OVERRIDE; |
| 22 virtual bool RunImpl() = 0; | 24 virtual bool RunImpl() = 0; |
| 23 | 25 |
| 26 // To be defined on construction by derived classes. | |
| 27 const int kStartState_; | |
|
Satish
2011/10/09 20:01:47
these can be private as they are not used by the d
Satish
2011/10/09 20:01:47
looking at other code I see the trend is to usuall
Leandro Graciá Gil
2011/10/10 18:59:38
Done.
Leandro Graciá Gil
2011/10/10 18:59:38
Done.
| |
| 28 const int kTransitionState_; | |
| 29 const int kEndState_; | |
| 30 const int kTransitionNotification_; | |
| 31 | |
| 24 private: | 32 private: |
| 25 // NotificationObserver. | 33 // NotificationObserver. |
| 26 virtual void Observe(int type, | 34 virtual void Observe(int type, |
| 27 const NotificationSource& source, | 35 const NotificationSource& source, |
| 28 const NotificationDetails& details) OVERRIDE; | 36 const NotificationDetails& details) OVERRIDE; |
| 29 | 37 |
| 30 NotificationRegistrar registrar_; | 38 NotificationRegistrar registrar_; |
| 39 bool listening_; | |
| 40 bool failed_; | |
| 31 }; | 41 }; |
| 32 | 42 |
| 33 // Implements experimental.speechInput.start. | 43 // Implements experimental.speechInput.start. |
| 34 class StartSpeechInputFunction : public SpeechInputAsyncFunction { | 44 class StartSpeechInputFunction : public SpeechInputAsyncFunction { |
| 45 public: | |
| 46 StartSpeechInputFunction(); | |
| 47 virtual ~StartSpeechInputFunction() {} | |
| 48 | |
| 35 protected: | 49 protected: |
| 36 virtual bool RunImpl() OVERRIDE; | 50 virtual bool RunImpl() OVERRIDE; |
| 37 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.start"); | 51 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.start"); |
| 38 }; | 52 }; |
| 39 | 53 |
| 40 // Implements experimental.speechInput.stop. | 54 // Implements experimental.speechInput.stop. |
| 41 class StopSpeechInputFunction : public SpeechInputAsyncFunction { | 55 class StopSpeechInputFunction : public SpeechInputAsyncFunction { |
| 56 public: | |
| 57 StopSpeechInputFunction(); | |
| 58 virtual ~StopSpeechInputFunction() {} | |
| 59 | |
| 42 protected: | 60 protected: |
| 43 virtual bool RunImpl() OVERRIDE; | 61 virtual bool RunImpl() OVERRIDE; |
| 44 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.stop"); | 62 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.stop"); |
| 45 }; | 63 }; |
| 46 | 64 |
| 47 // Implements experimental.speechInput.isRecording. | 65 // Implements experimental.speechInput.isRecording. |
| 48 class IsRecordingSpeechInputFunction : public SyncIOThreadExtensionFunction { | 66 class IsRecordingSpeechInputFunction : public SyncExtensionFunction { |
| 49 protected: | 67 protected: |
| 50 virtual bool RunImpl() OVERRIDE; | 68 virtual bool RunImpl() OVERRIDE; |
| 51 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.isRecording"); | 69 DECLARE_EXTENSION_FUNCTION_NAME("experimental.speechInput.isRecording"); |
| 52 }; | 70 }; |
| 53 | 71 |
| 54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ | 72 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_API_H_ |
| OLD | NEW |