| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SPEECH_TTS_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_TTS_ANDROID_H_ |
| 6 #define CHROME_BROWSER_SPEECH_TTS_ANDROID_H_ | 6 #define CHROME_BROWSER_SPEECH_TTS_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/speech/tts_platform.h" | 11 #include "chrome/browser/speech/tts_platform.h" |
| 12 #include "chrome/common/features.h" | |
| 13 | 12 |
| 14 class TtsPlatformImplAndroid : public TtsPlatformImpl { | 13 class TtsPlatformImplAndroid : public TtsPlatformImpl { |
| 15 public: | 14 public: |
| 16 // TtsPlatformImpl implementation. | 15 // TtsPlatformImpl implementation. |
| 17 bool PlatformImplAvailable() override; | 16 bool PlatformImplAvailable() override; |
| 18 bool Speak(int utterance_id, | 17 bool Speak(int utterance_id, |
| 19 const std::string& utterance, | 18 const std::string& utterance, |
| 20 const std::string& lang, | 19 const std::string& lang, |
| 21 const VoiceData& voice, | 20 const VoiceData& voice, |
| 22 const UtteranceContinuousParameters& params) override; | 21 const UtteranceContinuousParameters& params) override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 jint utterance_id); | 33 jint utterance_id); |
| 35 void OnErrorEvent(JNIEnv* env, | 34 void OnErrorEvent(JNIEnv* env, |
| 36 const base::android::JavaParamRef<jobject>& obj, | 35 const base::android::JavaParamRef<jobject>& obj, |
| 37 jint utterance_id); | 36 jint utterance_id); |
| 38 void OnStartEvent(JNIEnv* env, | 37 void OnStartEvent(JNIEnv* env, |
| 39 const base::android::JavaParamRef<jobject>& obj, | 38 const base::android::JavaParamRef<jobject>& obj, |
| 40 jint utterance_id); | 39 jint utterance_id); |
| 41 | 40 |
| 42 // Static functions. | 41 // Static functions. |
| 43 static TtsPlatformImplAndroid* GetInstance(); | 42 static TtsPlatformImplAndroid* GetInstance(); |
| 44 #if BUILDFLAG(ANDROID_JAVA_UI) | |
| 45 static bool Register(JNIEnv* env); | 43 static bool Register(JNIEnv* env); |
| 46 #endif | |
| 47 | 44 |
| 48 private: | 45 private: |
| 49 friend struct base::DefaultSingletonTraits<TtsPlatformImplAndroid>; | 46 friend struct base::DefaultSingletonTraits<TtsPlatformImplAndroid>; |
| 50 | 47 |
| 51 TtsPlatformImplAndroid(); | 48 TtsPlatformImplAndroid(); |
| 52 ~TtsPlatformImplAndroid() override; | 49 ~TtsPlatformImplAndroid() override; |
| 53 | 50 |
| 54 void SendFinalTtsEvent( | 51 void SendFinalTtsEvent( |
| 55 int utterance_id, TtsEventType event_type, int char_index); | 52 int utterance_id, TtsEventType event_type, int char_index); |
| 56 | 53 |
| 57 base::android::ScopedJavaGlobalRef<jobject> java_ref_; | 54 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 58 int utterance_id_; | 55 int utterance_id_; |
| 59 std::string utterance_; | 56 std::string utterance_; |
| 60 | 57 |
| 61 DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplAndroid); | 58 DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplAndroid); |
| 62 }; | 59 }; |
| 63 | 60 |
| 64 #endif // CHROME_BROWSER_SPEECH_TTS_ANDROID_H_ | 61 #endif // CHROME_BROWSER_SPEECH_TTS_ANDROID_H_ |
| OLD | NEW |