summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_tts_api_linux.cc
blob: 8ee228b595e8b65d1da044b466b723b83386a369 (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
// 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/extensions/extension_tts_api.h"

#include "base/singleton.h"

namespace util = extension_tts_api_util;

namespace {
const char kNotSupportedError[] =
    "Native speech synthesis not supported on this platform.";
};

class ExtensionTtsPlatformImplLinux : public ExtensionTtsPlatformImpl {
 public:
  virtual bool Speak(
      const std::string& utterance,
      const std::string& language,
      const std::string& gender,
      double rate,
      double pitch,
      double volume) {
    error_ = kNotSupportedError;
    return false;
  }

  virtual bool StopSpeaking() {
    error_ = kNotSupportedError;
    return false;
  }

  virtual bool IsSpeaking() {
    error_ = kNotSupportedError;
    return false;
  }

  // Get the single instance of this class.
  static ExtensionTtsPlatformImplLinux* GetInstance() {
    return ExtensionTtsPlatformImplLinux::GetInstance();
  }

 private:
  ExtensionTtsPlatformImplLinux() {}
  virtual ~ExtensionTtsPlatformImplLinux() {}

  friend struct DefaultSingletonTraits<ExtensionTtsPlatformImplLinux>;

  DISALLOW_COPY_AND_ASSIGN(ExtensionTtsPlatformImplLinux);
};

// static
ExtensionTtsPlatformImpl* ExtensionTtsPlatformImpl::GetInstance() {
  return ExtensionTtsPlatformImplLinux::GetInstance();
}