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

content / public / browser / tts_environment_android.h [blame]

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

#ifndef CONTENT_PUBLIC_BROWSER_TTS_ENVIRONMENT_ANDROID_H_
#define CONTENT_PUBLIC_BROWSER_TTS_ENVIRONMENT_ANDROID_H_

#include "base/functional/callback_forward.h"
#include "content/common/content_export.h"

namespace content {

class WebContents;

// Provides embedder specific information for text-to-speech.
class CONTENT_EXPORT TtsEnvironmentAndroid {
 public:
  virtual ~TtsEnvironmentAndroid() = default;

  // Returns whether utterances are allowed to speak from WebContents that are
  // hidden. Returning false prevents speaking utterance from hidden
  // WebContents, and also stops any playing utterance if the WebContents is
  // hidden.
  virtual bool CanSpeakUtterancesFromHiddenWebContents() = 0;

  // Returns true if speech is allowed at the current time. This is called
  // right before an utterance is about to be spoken.
  virtual bool CanSpeakNow() = 0;

  // Sets the callback that is notified when the value of CanSpeakNow() changes.
  virtual void SetCanSpeakNowChangedCallback(
      base::RepeatingClosure callback) = 0;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_TTS_ENVIRONMENT_ANDROID_H_