[ExtensionToolbarMac] Restrict action button drags to the container's bounds
[chromium-blink-merge.git] / chrome / browser / speech / tts_android.h
blob898418bb8c8b99fbfcd67e10e012660fae37a689
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SPEECH_TTS_ANDROID_H_
6 #define CHROME_BROWSER_SPEECH_TTS_ANDROID_H_
8 #include "base/android/jni_android.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "chrome/browser/speech/tts_platform.h"
12 class TtsPlatformImplAndroid : public TtsPlatformImpl {
13 public:
14 // TtsPlatformImpl implementation.
15 virtual bool PlatformImplAvailable() override;
16 virtual bool Speak(
17 int utterance_id,
18 const std::string& utterance,
19 const std::string& lang,
20 const VoiceData& voice,
21 const UtteranceContinuousParameters& params) override;
22 virtual bool StopSpeaking() override;
23 virtual void Pause() override;
24 virtual void Resume() override;
25 virtual bool IsSpeaking() override;
26 virtual void GetVoices(std::vector<VoiceData>* out_voices) override;
28 // Methods called from Java via JNI.
29 void VoicesChanged(JNIEnv* env, jobject obj);
30 void OnEndEvent(JNIEnv* env, jobject obj, jint utterance_id);
31 void OnErrorEvent(JNIEnv* env, jobject obj, jint utterance_id);
32 void OnStartEvent(JNIEnv* env, jobject obj, jint utterance_id);
34 // Static functions.
35 static TtsPlatformImplAndroid* GetInstance();
36 static bool Register(JNIEnv* env);
38 private:
39 friend struct DefaultSingletonTraits<TtsPlatformImplAndroid>;
41 TtsPlatformImplAndroid();
42 virtual ~TtsPlatformImplAndroid();
44 void SendFinalTtsEvent(
45 int utterance_id, TtsEventType event_type, int char_index);
47 base::android::ScopedJavaGlobalRef<jobject> java_ref_;
48 int utterance_id_;
49 std::string utterance_;
51 DISALLOW_COPY_AND_ASSIGN(TtsPlatformImplAndroid);
54 #endif // CHROME_BROWSER_SPEECH_TTS_ANDROID_H_