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 EXTENSIONS_SHELL_BROWSER_SHELL_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
8 #include "content/public/browser/speech_recognition_event_listener.h"
9 #include "content/public/browser/speech_recognition_manager_delegate.h"
11 namespace extensions
{
14 class ShellSpeechRecognitionManagerDelegate
15 : public content::SpeechRecognitionManagerDelegate
,
16 public content::SpeechRecognitionEventListener
{
18 ShellSpeechRecognitionManagerDelegate();
19 ~ShellSpeechRecognitionManagerDelegate() override
;
22 // SpeechRecognitionEventListener methods.
23 void OnRecognitionStart(int session_id
) override
;
24 void OnAudioStart(int session_id
) override
;
25 void OnEnvironmentEstimationComplete(int session_id
) override
;
26 void OnSoundStart(int session_id
) override
;
27 void OnSoundEnd(int session_id
) override
;
28 void OnAudioEnd(int session_id
) override
;
29 void OnRecognitionEnd(int session_id
) override
;
30 void OnRecognitionResults(
32 const content::SpeechRecognitionResults
& result
) override
;
33 void OnRecognitionError(
35 const content::SpeechRecognitionError
& error
) override
;
36 void OnAudioLevelsChange(int session_id
,
38 float noise_volume
) override
;
40 // SpeechRecognitionManagerDelegate methods.
41 void GetDiagnosticInformation(bool* can_report_metrics
,
42 std::string
* hardware_info
) override
;
43 void CheckRecognitionIsAllowed(
45 base::Callback
<void(bool ask_user
, bool is_allowed
)> callback
) override
;
46 content::SpeechRecognitionEventListener
* GetEventListener() override
;
47 bool FilterProfanities(int render_process_id
) override
;
49 static void CheckRenderViewType(
50 base::Callback
<void(bool ask_user
, bool is_allowed
)> callback
,
51 int render_process_id
,
54 DISALLOW_COPY_AND_ASSIGN(ShellSpeechRecognitionManagerDelegate
);
58 } // namespace extensions
60 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_CONTENT_BROWSER_CLIENT_H_