chromium/chrome/browser/speech/extension_api/tts_extension_api.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/speech/extension_api/tts_extension_api.h"

#include <stddef.h>

#include <memory>
#include <string>
#include <utility>

#include "base/lazy_instance.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
#include "chrome/browser/speech/extension_api/tts_extension_api_constants.h"
#include "content/public/browser/tts_controller.h"
#include "content/public/browser/tts_platform.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/process_manager.h"
#include "third_party/blink/public/mojom/speech/speech_synthesis.mojom.h"
#include "ui/base/l10n/l10n_util.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/speech/extension_api/tts_engine_extension_observer_chromeos.h"
#include "chrome/common/extensions/extension_constants.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/speech/tts_client_lacros.h"
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

constants;

#if BUILDFLAG(IS_CHROMEOS_ASH)
namespace {

// ChromeOS source that triggered text-to-speech utterance.
//
// These values are logged to UMA. Entries should not be renumbered and
// numeric values should never be reused. Please keep in sync with
// "TextToSpeechSource" in src/tools/metrics/histograms/enums.xml.
// LINT.IfChange(UMATextToSpeechSource)
enum class UMATextToSpeechSource {
  kOther = 0,
  kChromeVox = 1,
  kSelectToSpeak = 2,

  kMaxValue = kSelectToSpeak,
};
// LINT.ThenChange(/tools/metrics/histograms/metadata/accessibility/enums.xml:TextToSpeechSource)

}  // namespace
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace events {
const char kOnEvent[] =;
const char kOnVoicesChanged[] =;
}  // namespace events

const char* TtsEventTypeToString(content::TtsEventType event_type) {}

content::TtsEventType TtsEventTypeFromString(const std::string& str) {}

namespace extensions {

// One of these is constructed for each utterance, and deleted
// when the utterance gets any final event.
class TtsExtensionEventHandler : public content::UtteranceEventDelegate {};

TtsExtensionEventHandler::TtsExtensionEventHandler(
    const std::string& src_extension_id)
    :{}

void TtsExtensionEventHandler::OnTtsEvent(content::TtsUtterance* utterance,
                                          content::TtsEventType event_type,
                                          int char_index,
                                          int length,
                                          const std::string& error_message) {}

ExtensionFunction::ResponseAction TtsSpeakFunction::Run() {}

ExtensionFunction::ResponseAction TtsStopSpeakingFunction::Run() {}

ExtensionFunction::ResponseAction TtsPauseFunction::Run() {}

ExtensionFunction::ResponseAction TtsResumeFunction::Run() {}

void TtsIsSpeakingFunction::OnIsSpeakingComplete(bool speaking) {}

ExtensionFunction::ResponseAction TtsIsSpeakingFunction::Run() {}

ExtensionFunction::ResponseAction TtsGetVoicesFunction::Run() {}

TtsAPI::TtsAPI(content::BrowserContext* context) {}

TtsAPI::~TtsAPI() {}

static base::LazyInstance<
    BrowserContextKeyedAPIFactory<TtsAPI>>::DestructorAtExit g_factory =;

BrowserContextKeyedAPIFactory<TtsAPI>* TtsAPI::GetFactoryInstance() {}

void TtsAPI::OnVoicesChanged() {}

void TtsAPI::OnListenerAdded(const EventListenerInfo& details) {}

void TtsAPI::OnListenerRemoved(const EventListenerInfo& details) {}

void TtsAPI::StartOrStopListeningForVoicesChanged() {}

}  // namespace extensions