summaryrefslogtreecommitdiffstats
path: root/content/public/browser/speech_recognition_manager.h
blob: 89651c17a1284c42e4f3a13d68256e58ceab8b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_H_
#define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_H_

#include "base/string16.h"
#include "content/common/content_export.h"

namespace content {

// This is the gatekeeper for speech recognition in the browser process. It
// handles requests received from various render views and makes sure only one
// of them can use speech recognition at a time. It also sends recognition
// results and status events to the render views when required.
class SpeechRecognitionManager {
 public:
  // Returns the singleton instance.
  CONTENT_EXPORT static SpeechRecognitionManager* GetInstance();

  // Starts/restarts recognition for an existing request.
  virtual void StartRecognitionForRequest(int caller_id) = 0;

  // Cancels recognition for an existing request.
  virtual void CancelRecognitionForRequest(int caller_id) = 0;

  // Called when the user clicks outside the speech input UI causing it to close
  // and possibly have speech input go to another element.
  virtual void FocusLostForRequest(int caller_id) = 0;

  // Returns true if the OS reports existence of audio recording devices.
  virtual bool HasAudioInputDevices() = 0;

  // Used to determine if something else is currently making use of audio input.
  virtual bool IsCapturingAudio() = 0;

  // Returns a human readable string for the model/make of the active audio
  // input device for this computer.
  virtual string16 GetAudioInputDeviceModel() = 0;

  // Invokes the platform provided microphone settings UI in a non-blocking way,
  // via the BrowserThread::FILE thread.
  virtual void ShowAudioInputSettings() = 0;

 protected:
   virtual ~SpeechRecognitionManager() {}
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_MANAGER_H_