chromium/chrome/services/file_util/public/mojom/zip_file_creator.mojom

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

// Zip file creator provided by the utility process and exposed by mojo
// policy control to the Chrome browser process on OS_CHROMEOS.

module chrome.mojom;

import "components/services/filesystem/public/mojom/directory.mojom";
import "mojo/public/mojom/base/file.mojom";
import "mojo/public/mojom/base/file_path.mojom";

// Listener of a ZIP creation operation.
interface ZipListener {
  // Regularly called during ZIP creation operation to report progress, with the
  // total number of bytes, files and directories processed so far.
  OnProgress(uint64 bytes, uint32 files, uint32 directories);

  // Called once after the ZIP operation finished.
  OnFinished(bool success);
};

// Service that zips files and folders.
interface ZipFileCreator {
  // Creates a ZIP file and adds all the files and directories specified in
  // |relative_paths|. These paths are relative to the source directory
  // |src_dir|. If |relative_paths| is empty, then the whole source directory
  // |src_dir| is zipped. Folders are recursively explored. Progress is
  // regularly reported via the passed |listener|.
  CreateZipFile(pending_remote<filesystem.mojom.Directory> src_dir,
                array<mojo_base.mojom.FilePath> relative_paths,
                mojo_base.mojom.File zip_file,
                pending_remote<ZipListener> listener);
};