OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ | |
6 #define CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "base/timer/timer.h" | |
12 #include "content/public/browser/speech_recognition_event_listener.h" | |
13 #include "net/url_request/url_request_context_getter.h" | |
14 #include "ui/app_list/speech_ui_model_observer.h" | |
15 | |
16 namespace app_list { | |
17 | |
18 class SpeechRecognizerDelegate; | |
19 class StartPageService; | |
20 | |
21 // SpeechRecognizer is a wrapper around the speech recognition engine that | |
22 // simplifies its use from the UI thread. This class handles all setup/shutdown, | |
23 // collection of results, error cases, and threading. | |
24 class SpeechRecognizer : public base::RefCountedThreadSafe<SpeechRecognizer> { | |
Lei Zhang
2014/11/05 00:54:15
Does this still need to be RefCountedThreadSafe no
Anand Mistry (off Chromium)
2014/11/05 02:58:33
No it doesn't. Removed.
| |
25 public: | |
26 SpeechRecognizer(SpeechRecognizerDelegate* delegate, | |
27 net::URLRequestContextGetter* url_request_context_getter, | |
28 const std::string& locale); | |
29 | |
30 // Start/stop the speech recognizer. Must be called on the UI thread. | |
31 void Start(); | |
32 void Stop(); | |
33 | |
34 private: | |
35 friend class base::RefCountedThreadSafe<SpeechRecognizer>; | |
36 class EventListener; | |
37 | |
38 ~SpeechRecognizer(); | |
39 | |
40 SpeechRecognizerDelegate* delegate_; // Not owned. | |
41 scoped_refptr<EventListener> speech_event_listener_; | |
42 | |
43 // Weak pointer to pass to EventListener. | |
44 base::WeakPtrFactory<SpeechRecognizerDelegate> delegate_weak_factory_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); | |
47 }; | |
48 | |
49 } // namespace app_list | |
50 | |
51 #endif // CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_ | |
OLD | NEW |