| 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 #include "chrome/browser/speech/tts_android.h" | 5 #include "chrome/browser/speech/tts_android.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool TtsPlatformImplAndroid::StopSpeaking() { | 64 bool TtsPlatformImplAndroid::StopSpeaking() { |
| 65 JNIEnv* env = AttachCurrentThread(); | 65 JNIEnv* env = AttachCurrentThread(); |
| 66 Java_TtsPlatformImpl_stop(env, java_ref_.obj()); | 66 Java_TtsPlatformImpl_stop(env, java_ref_.obj()); |
| 67 utterance_id_ = 0; | 67 utterance_id_ = 0; |
| 68 utterance_.clear(); | 68 utterance_.clear(); |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void TtsPlatformImplAndroid::Pause() { |
| 73 StopSpeaking(); |
| 74 } |
| 75 |
| 76 void TtsPlatformImplAndroid::Resume() { |
| 77 } |
| 78 |
| 72 bool TtsPlatformImplAndroid::IsSpeaking() { | 79 bool TtsPlatformImplAndroid::IsSpeaking() { |
| 73 return (utterance_id_ != 0); | 80 return (utterance_id_ != 0); |
| 74 } | 81 } |
| 75 | 82 |
| 76 void TtsPlatformImplAndroid::GetVoices( | 83 void TtsPlatformImplAndroid::GetVoices( |
| 77 std::vector<VoiceData>* out_voices) { | 84 std::vector<VoiceData>* out_voices) { |
| 78 JNIEnv* env = AttachCurrentThread(); | 85 JNIEnv* env = AttachCurrentThread(); |
| 79 if (!Java_TtsPlatformImpl_isInitialized(env, java_ref_.obj())) | 86 if (!Java_TtsPlatformImpl_isInitialized(env, java_ref_.obj())) |
| 80 return; | 87 return; |
| 81 | 88 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 139 |
| 133 // static | 140 // static |
| 134 TtsPlatformImplAndroid* TtsPlatformImplAndroid::GetInstance() { | 141 TtsPlatformImplAndroid* TtsPlatformImplAndroid::GetInstance() { |
| 135 return Singleton<TtsPlatformImplAndroid>::get(); | 142 return Singleton<TtsPlatformImplAndroid>::get(); |
| 136 } | 143 } |
| 137 | 144 |
| 138 // static | 145 // static |
| 139 bool TtsPlatformImplAndroid::Register(JNIEnv* env) { | 146 bool TtsPlatformImplAndroid::Register(JNIEnv* env) { |
| 140 return RegisterNativesImpl(env); | 147 return RegisterNativesImpl(env); |
| 141 } | 148 } |
| OLD | NEW |