Commit 4de2b6ed authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Avoid using the Windows type SpeechRecognizerState

SpeechRecognizerState is an enum in the Windows platform
API for speech so using that name for a Chrome internal
type means that you get compilation errors if the platform
headers and the internal headers end up in the same
translation unit.

In jumbo builds that could happen (and in general it can also
happen) so this renames
SpeechRecognizerState -> SpeechRecognizerStatus
to avoid that.

An alternative would be to move the enum to a different, more
limited, scope.

Bug: 746957
Change-Id: I479470340ea2c582480b2692424a15bc6fb4581a
Reviewed-on: https://chromium-review.googlesource.com/901247Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#534709}
parent 37bccb7a
...@@ -61,7 +61,7 @@ void DictationChromeos::OnSpeechResult(const base::string16& query, ...@@ -61,7 +61,7 @@ void DictationChromeos::OnSpeechResult(const base::string16& query,
void DictationChromeos::OnSpeechSoundLevelChanged(int16_t level) {} void DictationChromeos::OnSpeechSoundLevelChanged(int16_t level) {}
void DictationChromeos::OnSpeechRecognitionStateChanged( void DictationChromeos::OnSpeechRecognitionStateChanged(
SpeechRecognizerState new_state) { SpeechRecognizerStatus new_state) {
if (new_state == SPEECH_RECOGNIZER_RECOGNIZING) if (new_state == SPEECH_RECOGNIZER_RECOGNIZING)
media::SoundsManager::Get()->Play(chromeos::SOUND_ENTER_SCREEN); media::SoundsManager::Get()->Play(chromeos::SOUND_ENTER_SCREEN);
} }
......
...@@ -29,7 +29,7 @@ class DictationChromeos : public SpeechRecognizerDelegate { ...@@ -29,7 +29,7 @@ class DictationChromeos : public SpeechRecognizerDelegate {
void OnSpeechResult(const base::string16& query, bool is_final) override; void OnSpeechResult(const base::string16& query, bool is_final) override;
void OnSpeechSoundLevelChanged(int16_t level) override; void OnSpeechSoundLevelChanged(int16_t level) override;
void OnSpeechRecognitionStateChanged( void OnSpeechRecognitionStateChanged(
SpeechRecognizerState new_state) override; SpeechRecognizerStatus new_state) override;
void GetSpeechAuthParameters(std::string* auth_scope, void GetSpeechAuthParameters(std::string* auth_scope,
std::string* auth_token) override; std::string* auth_token) override;
......
...@@ -58,7 +58,7 @@ class SpeechRecognizer::EventListener ...@@ -58,7 +58,7 @@ class SpeechRecognizer::EventListener
friend class base::RefCountedThreadSafe<SpeechRecognizer::EventListener>; friend class base::RefCountedThreadSafe<SpeechRecognizer::EventListener>;
~EventListener() override; ~EventListener() override;
void NotifyRecognitionStateChanged(SpeechRecognizerState new_state); void NotifyRecognitionStateChanged(SpeechRecognizerStatus new_state);
// Starts a timer for |timeout_seconds|. When the timer expires, will stop // Starts a timer for |timeout_seconds|. When the timer expires, will stop
// capturing audio and get a final utterance from the recognition manager. // capturing audio and get a final utterance from the recognition manager.
...@@ -161,7 +161,7 @@ void SpeechRecognizer::EventListener::StopOnIOThread() { ...@@ -161,7 +161,7 @@ void SpeechRecognizer::EventListener::StopOnIOThread() {
} }
void SpeechRecognizer::EventListener::NotifyRecognitionStateChanged( void SpeechRecognizer::EventListener::NotifyRecognitionStateChanged(
SpeechRecognizerState new_state) { SpeechRecognizerStatus new_state) {
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE, content::BrowserThread::UI, FROM_HERE,
base::Bind(&SpeechRecognizerDelegate::OnSpeechRecognitionStateChanged, base::Bind(&SpeechRecognizerDelegate::OnSpeechRecognitionStateChanged,
......
...@@ -35,7 +35,7 @@ class MockSpeechRecognizerDelegate : public SpeechRecognizerDelegate { ...@@ -35,7 +35,7 @@ class MockSpeechRecognizerDelegate : public SpeechRecognizerDelegate {
MOCK_METHOD2(OnSpeechResult, void(const base::string16&, bool)); MOCK_METHOD2(OnSpeechResult, void(const base::string16&, bool));
MOCK_METHOD1(OnSpeechSoundLevelChanged, void(int16_t)); MOCK_METHOD1(OnSpeechSoundLevelChanged, void(int16_t));
MOCK_METHOD1(OnSpeechRecognitionStateChanged, void(SpeechRecognizerState)); MOCK_METHOD1(OnSpeechRecognitionStateChanged, void(SpeechRecognizerStatus));
MOCK_METHOD2(GetSpeechAuthParameters, void(std::string*, std::string*)); MOCK_METHOD2(GetSpeechAuthParameters, void(std::string*, std::string*));
private: private:
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
// Requires cleanup. See crbug.com/800374. // Requires cleanup. See crbug.com/800374.
enum SpeechRecognizerState { enum SpeechRecognizerStatus {
SPEECH_RECOGNIZER_OFF = 0, SPEECH_RECOGNIZER_OFF = 0,
SPEECH_RECOGNIZER_READY, SPEECH_RECOGNIZER_READY,
SPEECH_RECOGNIZER_RECOGNIZING, SPEECH_RECOGNIZER_RECOGNIZING,
...@@ -34,7 +34,7 @@ class SpeechRecognizerDelegate { ...@@ -34,7 +34,7 @@ class SpeechRecognizerDelegate {
// Invoked when the state of speech recognition is changed. // Invoked when the state of speech recognition is changed.
virtual void OnSpeechRecognitionStateChanged( virtual void OnSpeechRecognitionStateChanged(
SpeechRecognizerState new_state) = 0; SpeechRecognizerStatus new_state) = 0;
// Get the OAuth2 scope and token to pass to the speech recognizer. Does not // Get the OAuth2 scope and token to pass to the speech recognizer. Does not
// modify the arguments if no auth token is available or allowed. // modify the arguments if no auth token is available or allowed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment