chromium/ash/webui/projector_app/public/mojom/projector_types.mojom

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ash.projector.mojom;

// Passed from the browser to JS WebUI to provide the new
// screencast precondition state.
enum NewScreencastPreconditionState {
    kDisabled = 1,
    kEnabled = 2,
    kHidden = 3,
};

// Passed from the browser to JS WebUI to provide the reason
// for the new screencast precondition state.
enum NewScreencastPreconditionReason {
    kSodaInstallationErrorUnspecifiedError = 0,
    kOnDeviceRecognitionNotSupported = 1,
    kUserLocaleNotSupported = 2,
    kInProjectorSession = 3,
    kScreenRecordingInProgress = 4,
    kSodaDownloadInProgress = 5,
    kOutOfDiskSpace = 6,
    kNoMic = 7,
    kDriveFSUnMounted = 8,
    kDriveFSMountFailed = 9,
    kOthers = 10,
    kSodaInstallationErrorNeedsReboot = 11,
    kAudioCaptureDisabledByPolicy = 12,
    kEnabledBySoda = 13,
    kEnabledByServerSideSpeechRecognition = 14,
};

// Passed from the browser to JS WebUI to pass new screencast
// precondition and the reasons for the enabled/disabled state.
struct NewScreencastPrecondition {
    NewScreencastPreconditionState state;
    array<NewScreencastPreconditionReason> reasons;
};

// The pending screencast that is currently being uploaded to
// Google Drive through DrifeFs. Sent from the browser process to
// the Javascript world.
struct PendingScreencast {
    // The display name of screencast. If `container_dir` is
    // "/root/projector_data/abc", the `name` is "abc".
    string name;
    // The upload progress of the pending screencast.
    uint32 upload_progress;
    // The media file created time.
    double created_time;
    // True after observing
    // drivefs::mojom::DriveError::kCantUploadStorageFull for
    // the first time. Screencast's status might go through
    // error -> uploading -> error -> ... -> uploaded,
    // but it will display the error state until
    // successfully uploaded to avoid over commnucation with user.
    bool upload_failed;
};

enum PrefsThatProjectorCanAskFor {
    kProjectorCreationFlowEnabled = 0,
    kProjectorExcludeTranscriptDialogShown = 1,
    kProjectorViewerOnboardingShowCount = 2,
    kProjectorGalleryOnboardingShowCount = 3,
};

// The error code for the XhrResponse.
enum XhrResponseCode {
    kSuccess = 0,
    kTokenFetchFailure = 1,
    kXhrFetchFailure = 2,
    kUnsupportedURL = 3,
    kInvalidAccountEmail = 4,
};

// Net error codes used by PWA,
// Defined in google3/third_party/javascript/closure/net/errorcode.js.
enum JsNetErrorCode {
  kNoError = 0,
  kAccessDenied = 1,
  kFileNotFound = 2,
  kFFSilentError = 3,
  kCustomError = 4,
  kException = 5,
  kHttpError = 6,
  kAbort = 7,
  kTimeout = 8,
  kOffline = 9,
};

// XhrResponse sent from the browser process the JS WebUI.
struct XhrResponse {
   string response;
   XhrResponseCode response_code;
   JsNetErrorCode? net_error_code;
};

// The HTTP request type that comes from the JS WebUI.
enum RequestType {
    kPost = 0,
    kGet = 1,
    kPatch = 2,
    kDelete = 3,
};

// Sent from the browser to the JS WebUI to provide information
// about the account.
struct Account {
    // The associated email address.
    string email;

    // Whether the account is the primary user account.
    bool is_primary_user;
};

// Video information sent from the browser process to JS webui.
struct VideoInfo {
    double duration_millis;
    string file_id;
};

// Get video result sent from the browser process to JS webui.
// The result returns either an error message or video result.
union GetVideoResult {
    VideoInfo video;
    string error_message;
};