atom_speech_recognition_manager_delegate.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright (c) 2014 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
  5. #define ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
  6. #include <string>
  7. #include "base/macros.h"
  8. #include "content/public/browser/speech_recognition_event_listener.h"
  9. #include "content/public/browser/speech_recognition_manager_delegate.h"
  10. namespace atom {
  11. class AtomSpeechRecognitionManagerDelegate
  12. : public content::SpeechRecognitionManagerDelegate,
  13. public content::SpeechRecognitionEventListener {
  14. public:
  15. AtomSpeechRecognitionManagerDelegate();
  16. ~AtomSpeechRecognitionManagerDelegate() override;
  17. // content::SpeechRecognitionEventListener:
  18. void OnRecognitionStart(int session_id) override;
  19. void OnAudioStart(int session_id) override;
  20. void OnEnvironmentEstimationComplete(int session_id) override;
  21. void OnSoundStart(int session_id) override;
  22. void OnSoundEnd(int session_id) override;
  23. void OnAudioEnd(int session_id) override;
  24. void OnRecognitionEnd(int session_id) override;
  25. void OnRecognitionResults(
  26. int session_id,
  27. const content::SpeechRecognitionResults& result) override;
  28. void OnRecognitionError(
  29. int session_id,
  30. const content::SpeechRecognitionError& error) override;
  31. void OnAudioLevelsChange(int session_id,
  32. float volume,
  33. float noise_volume) override;
  34. // content::SpeechRecognitionManagerDelegate:
  35. void CheckRecognitionIsAllowed(
  36. int session_id,
  37. base::OnceCallback<void(bool ask_user, bool is_allowed)> callback)
  38. override;
  39. content::SpeechRecognitionEventListener* GetEventListener() override;
  40. bool FilterProfanities(int render_process_id) override;
  41. private:
  42. DISALLOW_COPY_AND_ASSIGN(AtomSpeechRecognitionManagerDelegate);
  43. };
  44. } // namespace atom
  45. #endif // ATOM_BROWSER_ATOM_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_