Index: chrome/browser/ui/app_list/app_list_speech_recognizer.h |
diff --git a/chrome/browser/ui/app_list/app_list_speech_recognizer.h b/chrome/browser/ui/app_list/app_list_speech_recognizer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dfda90d3a5e7216a5e8273f5384d39c5cf3c5694 |
--- /dev/null |
+++ b/chrome/browser/ui/app_list/app_list_speech_recognizer.h |
@@ -0,0 +1,78 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SPEECH_RECOGNIZER_H_ |
+#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SPEECH_RECOGNIZER_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/weak_ptr.h" |
+#include "base/timer/timer.h" |
+#include "content/public/browser/speech_recognition_event_listener.h" |
+#include "net/url_request/url_request_context_getter.h" |
+#include "ui/app_list/speech_ui_model_observer.h" |
Lei Zhang
2014/10/30 05:15:42
not used?
Anand Mistry (off Chromium)
2014/10/31 00:50:06
Used for app_list::SpeechRecognitionState enum.
|
+ |
+namespace content { |
+struct SpeechRecognitionSessionConfig; |
Lei Zhang
2014/10/30 05:15:42
not need?
Anand Mistry (off Chromium)
2014/10/31 00:50:06
Done.
|
+} |
+ |
+namespace app_list { |
+ |
+class StartPageService; |
+ |
+class AppListSpeechRecognizer : |
Lei Zhang
2014/10/30 05:15:42
Please write a brief description of what AppListSp
Lei Zhang
2014/10/30 05:15:42
colon goes on the next line.
Jun Mukai
2014/10/30 07:08:34
This is my personal preference, but app_list::AppL
Anand Mistry (off Chromium)
2014/10/31 00:50:06
Done.
Anand Mistry (off Chromium)
2014/10/31 00:50:06
Done.
|
+ public base::RefCountedThreadSafe<AppListSpeechRecognizer>, |
+ public content::SpeechRecognitionEventListener { |
+ public: |
+ AppListSpeechRecognizer(StartPageService* start_page_service, |
+ const std::string& locale); |
+ |
+ // Start/stop the speech recognizer. |
+ void Start(); |
+ void Stop(); |
+ |
+ protected: |
+ // Overidden from content::SpeechRecognitionEventListener: |
+ void OnRecognitionStart(int session_id) override; |
+ void OnRecognitionEnd(int session_id) override; |
+ void OnRecognitionResults( |
+ int session_id, |
+ const content::SpeechRecognitionResults& results) override; |
+ void OnRecognitionError( |
+ int session_id, const content::SpeechRecognitionError& error) override; |
+ void OnSoundStart(int session_id) override; |
+ void OnSoundEnd(int session_id) override; |
+ void OnAudioLevelsChange( |
+ int session_id, float volume, float noise_volume) override; |
+ // Overridden, but unimplemented. |
+ void OnEnvironmentEstimationComplete(int session_id) override {} |
Lei Zhang
2014/10/30 05:15:42
implementations, even empties ones, should go in t
Anand Mistry (off Chromium)
2014/10/31 00:50:06
Done.
|
+ void OnAudioStart(int session_id) override {} |
+ void OnAudioEnd(int session_id) override {} |
+ |
+ private: |
+ friend class base::RefCountedThreadSafe<AppListSpeechRecognizer>; |
+ ~AppListSpeechRecognizer(); |
+ |
+ void StartOnIOThread( |
+ int render_process_id, |
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); |
+ void StopOnIOThread(); |
+ |
+ void NotifyRecognitionStateChanged(SpeechRecognitionState new_state); |
+ |
+ void StartSpeechTimeout(); |
+ void StopSpeechTimeout(); |
+ void SpeechTimeout(); |
+ |
+ StartPageService* start_page_service_; // Not owned. |
+ std::string locale_; |
+ base::Timer speech_timeout_; |
+ int session_; |
+ |
+ base::WeakPtrFactory<AppListSpeechRecognizer> weak_factory_; |
+}; |
Lei Zhang
2014/10/30 05:15:42
DISALLOW_COPY_AND_ASSIGN
Anand Mistry (off Chromium)
2014/10/31 00:50:06
Done.
|
+ |
+} // namespace app_list |
+ |
+#endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SPEECH_RECOGNIZER_H_ |