blob: 0325c1ffb70f76f2f7206dfdb9a2684ad3091d30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/cros/speech_synthesis_library.h"
#include "base/message_loop.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "cros/chromeos_speech_synthesis.h"
namespace chromeos {
class SpeechSynthesisLibraryImpl : public SpeechSynthesisLibrary {
public:
SpeechSynthesisLibraryImpl() {}
virtual ~SpeechSynthesisLibraryImpl() {}
bool Speak(const char* text) {
return chromeos::Speak(text);
}
bool SetSpeakProperties(const char* props) {
return chromeos::SetSpeakProperties(props);
}
bool StopSpeaking() {
return chromeos::StopSpeaking();
}
bool IsSpeaking() {
return chromeos::IsSpeaking();
}
void InitTts(InitStatusCallback callback) {
chromeos::InitTts(callback);
}
private:
DISALLOW_COPY_AND_ASSIGN(SpeechSynthesisLibraryImpl);
};
class SpeechSynthesisLibraryStubImpl : public SpeechSynthesisLibrary {
public:
SpeechSynthesisLibraryStubImpl() {}
virtual ~SpeechSynthesisLibraryStubImpl() {}
bool Speak(const char* text) { return true; }
bool SetSpeakProperties(const char* props) { return true; }
bool StopSpeaking() { return true; }
bool IsSpeaking() { return false; }
void InitTts(InitStatusCallback callback) {}
private:
DISALLOW_COPY_AND_ASSIGN(SpeechSynthesisLibraryStubImpl);
};
// static
SpeechSynthesisLibrary* SpeechSynthesisLibrary::GetImpl(bool stub) {
if (stub)
return new SpeechSynthesisLibraryStubImpl();
else
return new SpeechSynthesisLibraryImpl();
}
} // namespace chromeos
|