chromium/chromeos/crosapi/mojom/file_manager.mojom

// 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.

module crosapi.mojom;

import "mojo/public/mojom/base/file_path.mojom";

[Stable, Extensible]
enum OpenResult {
  kUnknown = 0,
  kSucceeded = 1,
  // Specified path does not exist.
  kFailedPathNotFound = 2,
  // Type of object found at path does not match what was expected. For example,
  // OpenFile was called on a folder.
  kFailedInvalidType = 3,
  // No file handler found for the file. For example, user tried to open a macOS
  // .dmg file.
  kFailedNoHandlerForFileType = 4,
  // Open failed due to some other error.
  kFailedFileError = 5,
};

// Interacts with the file manager (the Chrome OS equivalent of macOS Finder or
// Windows Explorer). Implemented in ash-chrome.
[Stable, Uuid="61e61690-fb13-40c8-a167-d7fc18a8fe6b"]
interface FileManager {
  // Deprecated. Prefer ShowItemInFolder() below.
  DeprecatedShowItemInFolder@0(mojo_base.mojom.FilePath path);

  // Opens the folder containing the item specified by |path| and selects the
  // item. If the path is invalid or the file doesn't exist, an error dialog is
  // shown. Added in M88.
  [MinVersion=1]
  ShowItemInFolder@1(mojo_base.mojom.FilePath path) => (OpenResult result);

  // As above, but opens the folder at |path| and does not select an item.
  // Added in M88.
  [MinVersion=1]
  OpenFolder@2(mojo_base.mojom.FilePath path) => (OpenResult result);

  // Opens the file specified by |path| in the desktop's default manner. For
  // example, an image file might be opened by the image gallery app. Added in
  // M88.
  [MinVersion=1]
  OpenFile@3(mojo_base.mojom.FilePath path) => (OpenResult result);
};