blob: 5281022ffd27e36179fa24ef9fcd5c786dd60430 [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package content;
// Used to serialize a Native File System handle representing a file or
// directory on the local native file system.
//
// Paths are stored as a serialized base::FilePath. I.e. on platforms where
// base::FilePath uses 8 bit characters this directly contains those
// characters, and on platforms where base::FilePath uses 16 bit characters
// those characters are serialized using the current platform's endianness.
// This means paths can't necesarilly be read back on different platforms
// or computers from where they were written, but since the path references
// something on the local file system that likely doesn't exist on a different
// computer anyway this should be no problem in practice.
message NativeFileData {
// The root path of a Native File System handle is the path that the user
// selected in a file or directory picker. All permissions related to the
// handle are based on this path.
required bytes root_path = 1;
// If |relative_path| is empty, |root_path| is the full path to the file or
// directory this object represents. If non-empty this path should be appended
// to |root_path| to get the full path. This can happen for example if a
// website has access to a directory, but stores references to files or
// directories inside that picked directory to IndexedDB. In that case we
// still want permissions to be based on the originally picked path, but also
// need to know the path to the actual file or directory that was stored.
required bytes relative_path = 2;
}
// Used to serialize a Native File System handle representing a file or
// directory in the origin scoped sandboxed file system.
//
// The same comment as for the above NativeFileData messages applies here as
// well regarding serialization format of the paths themselves.
message SandboxedFileData {
// The path to the file or directory relative to the root of the origin's
// sandboxed file system.
required bytes virtual_path = 1;
}
// Used to serialize any Native File System handle, for example when a handle is
// stored in IndexedDB.
message NativeFileSystemHandleData {
// Is this handle representing a file or a directory?
enum HandleType {
kFile = 0;
kDirectory = 1;
}
required HandleType handle_type = 1;
// The actual data, depending on the type of file system this handle is backed
// by.
oneof data {
SandboxedFileData sandboxed = 2;
NativeFileData native = 3;
}
}