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

ash / public / cpp / projector / speech_recognition_availability.h [blame]

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

#ifndef ASH_PUBLIC_CPP_PROJECTOR_SPEECH_RECOGNITION_AVAILABILITY_H_
#define ASH_PUBLIC_CPP_PROJECTOR_SPEECH_RECOGNITION_AVAILABILITY_H_

#include "ash/public/cpp/ash_public_export.h"

namespace ash {

enum class ASH_PUBLIC_EXPORT OnDeviceRecognitionAvailability : int {
  // Device does not support SODA (Speech on Device API)
  kSodaNotAvailable = 0,
  // User's language is not supported by SODA.
  kUserLanguageNotAvailable,
  // SODA binary is not yet installed.
  kSodaNotInstalled,
  // SODA binary and language packs are downloading.
  kSodaInstalling,
  // SODA installation failed.
  kSodaInstallationErrorUnspecified,
  // SODA installation error needs reboot
  kSodaInstallationErrorNeedsReboot,
  // SODA is available to be used.
  kAvailable,
};

enum class ASH_PUBLIC_EXPORT ServerBasedRecognitionAvailability : int {
  // Server based feature is not available.
  kServerBasedRecognitionNotAvailable = 0,
  // User's language is not supported by server based recognition.
  kUserLanguageNotAvailable,
  // Server based speech recognition is available.
  kAvailable,
};

struct ASH_PUBLIC_EXPORT SpeechRecognitionAvailability {
  bool use_on_device = true;
  OnDeviceRecognitionAvailability on_device_availability;
  ServerBasedRecognitionAvailability server_based_availability;

  bool IsAvailable() const;
};

}  // namespace ash

#endif  // ASH_PUBLIC_CPP_PROJECTOR_SPEECH_RECOGNITION_AVAILABILITY_H_