Rename vector icon header files.
[chromium-blink-merge.git] / chrome / browser / speech / chrome_speech_recognition_manager_delegate.h
blobb806b9979f88cdc7a18636eac5b6415fac9c2bba
1 // Copyright (c) 2012 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_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
6 #define CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/public/browser/speech_recognition_event_listener.h"
11 #include "content/public/browser/speech_recognition_manager_delegate.h"
12 #include "content/public/browser/speech_recognition_session_config.h"
14 namespace speech {
16 // This is Chrome's implementation of the SpeechRecognitionManagerDelegate
17 // interface.
18 class ChromeSpeechRecognitionManagerDelegate
19 : public content::SpeechRecognitionManagerDelegate,
20 public content::SpeechRecognitionEventListener {
21 public:
22 ChromeSpeechRecognitionManagerDelegate();
23 ~ChromeSpeechRecognitionManagerDelegate() override;
25 protected:
26 // SpeechRecognitionEventListener methods.
27 void OnRecognitionStart(int session_id) override;
28 void OnAudioStart(int session_id) override;
29 void OnEnvironmentEstimationComplete(int session_id) override;
30 void OnSoundStart(int session_id) override;
31 void OnSoundEnd(int session_id) override;
32 void OnAudioEnd(int session_id) override;
33 void OnRecognitionEnd(int session_id) override;
34 void OnRecognitionResults(
35 int session_id,
36 const content::SpeechRecognitionResults& result) override;
37 void OnRecognitionError(
38 int session_id,
39 const content::SpeechRecognitionError& error) override;
40 void OnAudioLevelsChange(int session_id,
41 float volume,
42 float noise_volume) override;
44 // SpeechRecognitionManagerDelegate methods.
45 void GetDiagnosticInformation(bool* can_report_metrics,
46 std::string* hardware_info) override;
47 void CheckRecognitionIsAllowed(
48 int session_id,
49 base::Callback<void(bool ask_user, bool is_allowed)> callback) override;
50 content::SpeechRecognitionEventListener* GetEventListener() override;
51 bool FilterProfanities(int render_process_id) override;
53 // Callback called by |tab_watcher_| on the IO thread to signal tab closure.
54 virtual void TabClosedCallback(int render_process_id, int render_view_id);
56 private:
57 class OptionalRequestInfo;
58 class TabWatcher;
60 // Checks for VIEW_TYPE_TAB_CONTENTS host in the UI thread and notifies back
61 // the result in the IO thread through |callback|.
62 static void CheckRenderViewType(
63 base::Callback<void(bool ask_user, bool is_allowed)> callback,
64 int render_process_id,
65 int render_view_id);
67 scoped_refptr<OptionalRequestInfo> optional_request_info_;
68 scoped_refptr<TabWatcher> tab_watcher_;
70 DISALLOW_COPY_AND_ASSIGN(ChromeSpeechRecognitionManagerDelegate);
73 } // namespace speech
75 #endif // CHROME_BROWSER_SPEECH_CHROME_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_