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_UI_APP_LIST_SPEECH_RECOGNIZER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 | 11 |
| 12 namespace content { |
| 13 struct SpeechRecognitionSessionPreamble; |
| 14 } |
| 15 |
12 namespace net { | 16 namespace net { |
13 class URLRequestContextGetter; | 17 class URLRequestContextGetter; |
14 } | 18 } |
15 | 19 |
16 namespace app_list { | 20 namespace app_list { |
17 | 21 |
18 class SpeechRecognizerDelegate; | 22 class SpeechRecognizerDelegate; |
19 | 23 |
20 // SpeechRecognizer is a wrapper around the speech recognition engine that | 24 // SpeechRecognizer is a wrapper around the speech recognition engine that |
21 // simplifies its use from the UI thread. This class handles all setup/shutdown, | 25 // simplifies its use from the UI thread. This class handles all setup/shutdown, |
22 // collection of results, error cases, and threading. | 26 // collection of results, error cases, and threading. |
23 class SpeechRecognizer { | 27 class SpeechRecognizer { |
24 public: | 28 public: |
25 SpeechRecognizer(const base::WeakPtr<SpeechRecognizerDelegate>& delegate, | 29 SpeechRecognizer(const base::WeakPtr<SpeechRecognizerDelegate>& delegate, |
26 net::URLRequestContextGetter* url_request_context_getter, | 30 net::URLRequestContextGetter* url_request_context_getter, |
27 const std::string& locale); | 31 const std::string& locale); |
28 ~SpeechRecognizer(); | 32 ~SpeechRecognizer(); |
29 | 33 |
30 // Start/stop the speech recognizer. Must be called on the UI thread. | 34 // Start/stop the speech recognizer. |preamble| contains the preamble audio to |
31 void Start(); | 35 // log if auth parameters are available. |
| 36 // Must be called on the UI thread. |
| 37 void Start( |
| 38 const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble); |
32 void Stop(); | 39 void Stop(); |
33 | 40 |
34 private: | 41 private: |
35 class EventListener; | 42 class EventListener; |
36 | 43 |
37 base::WeakPtr<SpeechRecognizerDelegate> delegate_; | 44 base::WeakPtr<SpeechRecognizerDelegate> delegate_; |
38 scoped_refptr<EventListener> speech_event_listener_; | 45 scoped_refptr<EventListener> speech_event_listener_; |
39 | 46 |
40 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); | 47 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); |
41 }; | 48 }; |
42 | 49 |
43 } // namespace app_list | 50 } // namespace app_list |
44 | 51 |
45 #endif // CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ | 52 #endif // CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ |
OLD | NEW |