Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / ui / app_list / speech_recognizer.h
blob9b6a502d7360a1876a2e0cfc8ff3ff56ecdb5252
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.
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_
8 #include <string>
10 #include "base/memory/weak_ptr.h"
12 namespace content {
13 struct SpeechRecognitionSessionPreamble;
16 namespace net {
17 class URLRequestContextGetter;
20 namespace app_list {
22 class SpeechRecognizerDelegate;
24 // SpeechRecognizer is a wrapper around the speech recognition engine that
25 // simplifies its use from the UI thread. This class handles all setup/shutdown,
26 // collection of results, error cases, and threading.
27 class SpeechRecognizer {
28 public:
29 SpeechRecognizer(const base::WeakPtr<SpeechRecognizerDelegate>& delegate,
30 net::URLRequestContextGetter* url_request_context_getter,
31 const std::string& locale);
32 ~SpeechRecognizer();
34 // Start/stop the speech recognizer. |preamble| contains the preamble audio to
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);
39 void Stop();
41 private:
42 class EventListener;
44 base::WeakPtr<SpeechRecognizerDelegate> delegate_;
45 scoped_refptr<EventListener> speech_event_listener_;
47 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer);
50 } // namespace app_list
52 #endif // CHROME_BROWSER_UI_APP_LIST_SPEECH_RECOGNIZER_H_