refactor: do not subclass ElectronSpeechRecognitionManagerDelegate from SpeechRecognitionEventListener (#42806)
All the listener functions are empty stubs (and have been since d4e3c39
)
so it doesn't seem like we need a listener?
SpeechRecognitionManagerDelegate declares this method:
> // Checks whether the delegate is interested (returning a non nullptr
> // ptr) or not (returning nullptr) in receiving a copy of all sessions
> // events. This is called on the IO thread.
> virtual SpeechRecognitionEventListener* GetEventListener() = 0;
This PR has ElectronSpeechRecognitionManagerDelegate stop subclassing
from the Listener and changes GetEventListener() to return nullptr.
This commit is contained in:
parent
48fc352bcf
commit
f9d94211bb
2 changed files with 2 additions and 49 deletions
|
@ -16,33 +16,6 @@ ElectronSpeechRecognitionManagerDelegate::
|
|||
ElectronSpeechRecognitionManagerDelegate::
|
||||
~ElectronSpeechRecognitionManagerDelegate() = default;
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnRecognitionStart(
|
||||
int session_id) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnAudioStart(int session_id) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnSoundStart(int session_id) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnSoundEnd(int session_id) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnAudioEnd(int session_id) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnRecognitionEnd(
|
||||
int session_id) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnRecognitionResults(
|
||||
int session_id,
|
||||
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>& results) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnRecognitionError(
|
||||
int session_id,
|
||||
const media::mojom::SpeechRecognitionError& error) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
|
||||
int session_id,
|
||||
float volume,
|
||||
float noise_volume) {}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
|
||||
int session_id,
|
||||
base::OnceCallback<void(bool ask_user, bool is_allowed)> callback) {
|
||||
|
@ -51,7 +24,7 @@ void ElectronSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
|
|||
|
||||
content::SpeechRecognitionEventListener*
|
||||
ElectronSpeechRecognitionManagerDelegate::GetEventListener() {
|
||||
return this;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ElectronSpeechRecognitionManagerDelegate::BindSpeechRecognitionContext(
|
||||
|
|
|
@ -5,16 +5,13 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_ELECTRON_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
|
||||
#define ELECTRON_SHELL_BROWSER_ELECTRON_SPEECH_RECOGNITION_MANAGER_DELEGATE_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "content/public/browser/speech_recognition_event_listener.h"
|
||||
#include "content/public/browser/speech_recognition_manager_delegate.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
class ElectronSpeechRecognitionManagerDelegate
|
||||
: public content::SpeechRecognitionManagerDelegate,
|
||||
public content::SpeechRecognitionEventListener {
|
||||
: public content::SpeechRecognitionManagerDelegate {
|
||||
public:
|
||||
ElectronSpeechRecognitionManagerDelegate();
|
||||
~ElectronSpeechRecognitionManagerDelegate() override;
|
||||
|
@ -25,23 +22,6 @@ class ElectronSpeechRecognitionManagerDelegate
|
|||
ElectronSpeechRecognitionManagerDelegate& operator=(
|
||||
const ElectronSpeechRecognitionManagerDelegate&) = delete;
|
||||
|
||||
// content::SpeechRecognitionEventListener:
|
||||
void OnRecognitionStart(int session_id) override;
|
||||
void OnAudioStart(int session_id) override;
|
||||
void OnSoundStart(int session_id) override;
|
||||
void OnSoundEnd(int session_id) override;
|
||||
void OnAudioEnd(int session_id) override;
|
||||
void OnRecognitionEnd(int session_id) override;
|
||||
void OnRecognitionResults(
|
||||
int session_id,
|
||||
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>&) override;
|
||||
void OnRecognitionError(
|
||||
int session_id,
|
||||
const media::mojom::SpeechRecognitionError& error) override;
|
||||
void OnAudioLevelsChange(int session_id,
|
||||
float volume,
|
||||
float noise_volume) override;
|
||||
|
||||
// content::SpeechRecognitionManagerDelegate:
|
||||
void CheckRecognitionIsAllowed(
|
||||
int session_id,
|
||||
|
|
Loading…
Reference in a new issue