mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 16:26:10 +03:00
204 lines
4.9 KiB
Plaintext
204 lines
4.9 KiB
Plaintext
// Copyright 2018 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.
|
|
|
|
module drivefs.mojom;
|
|
|
|
import "mojo/public/mojom/base/file_path.mojom";
|
|
import "mojo/public/mojom/base/time.mojom";
|
|
|
|
// This file tracks platform/drivefs/mojom/drivefs.mojom. Changes should be made
|
|
// there first and then replicated here.
|
|
|
|
// Implemented by DriveFS, used from Chrome.
|
|
interface DriveFsBootstrap {
|
|
// Initialize a DriveFS instance with its configuration and mojo connections
|
|
// to the browser.
|
|
Init(DriveFsConfiguration config, DriveFs& drive_fs,
|
|
DriveFsDelegate delegate);
|
|
};
|
|
|
|
// Implemented by DriveFS, used from Chrome.
|
|
interface DriveFs {
|
|
// Returns the metadata for |path|. Thumbnail requests may require requesting
|
|
// a thumbnail from the server so thumbnails are only populated for requests
|
|
// where |want_thumbnail| is true.
|
|
GetMetadata(mojo_base.mojom.FilePath path, bool want_thumbnail) => (
|
|
FileError error, FileMetadata? metadata);
|
|
|
|
// Sets the file at |path| to pinned or unpinned depending on the value of
|
|
// |pinned|.
|
|
SetPinned(mojo_base.mojom.FilePath path, bool pinned) => (FileError error);
|
|
|
|
// Set whether syncing should be paused.
|
|
SetPauseSyncing(bool pause);
|
|
};
|
|
|
|
// Implemented by Chrome, used from DriveFS.
|
|
interface DriveFsDelegate {
|
|
// Get an access token for |client_id| and |app_id| with access to |scopes|.
|
|
// |access_token| is only valid if |status| is kSuccess.
|
|
GetAccessToken(string client_id, string app_id, array<string> scopes) => (
|
|
AccessTokenStatus status, string access_token);
|
|
|
|
// Invoked when the mount is ready for use.
|
|
OnMounted();
|
|
|
|
// Invoked if mounting has failed. If retry_delay is present the
|
|
// browser should try to mount again after the specified interval.
|
|
OnMountFailed(mojo_base.mojom.TimeDelta? retry_delay);
|
|
|
|
// Invoked when the mount is going away. If retry_delay is present the
|
|
// browser should try to mount again after the specified interval.
|
|
OnUnmounted(mojo_base.mojom.TimeDelta? retry_delay);
|
|
|
|
// Invoked when the syncing status changes.
|
|
OnSyncingStatusUpdate(SyncingStatus status);
|
|
|
|
// Invoked when server-side file changes are received.
|
|
OnFilesChanged(array<FileChange> changes);
|
|
};
|
|
|
|
struct DriveFsConfiguration {
|
|
string user_email;
|
|
};
|
|
|
|
enum AccessTokenStatus {
|
|
// Getting an access token succeeded.
|
|
kSuccess,
|
|
|
|
// Getting an access token failed due to a transient error (e.g. network
|
|
// access is unavailable).
|
|
kTransientError,
|
|
|
|
// Getting an access token failed due to an auth error.
|
|
kAuthError,
|
|
};
|
|
|
|
enum FileError {
|
|
// These match the values of drive::FileError in
|
|
// //components/drive/file_errors.h
|
|
kOk = 0,
|
|
kFailed = -1,
|
|
kInUse = -2,
|
|
kExists = -3,
|
|
kNotFound = -4,
|
|
kAccessDenied = -5,
|
|
kTooManyOpened = -6,
|
|
kNoMemory = -7,
|
|
kNoServerSpace = -8,
|
|
kNotADirectory = -9,
|
|
kInvalidOperation = -10,
|
|
kSecurity = -11,
|
|
kAbort = -12,
|
|
kNotAFile = -13,
|
|
kNotEmpty = -14,
|
|
kInvalidUrl = -15,
|
|
kNoConnection = -16,
|
|
kNoLocalSpace = -17,
|
|
kServiceUnavailable = -18,
|
|
};
|
|
|
|
struct FileMetadata {
|
|
enum Type {
|
|
// A regular file.
|
|
kFile,
|
|
|
|
// A hosted document (e.g. a gdoc).
|
|
kHosted,
|
|
|
|
// A directory.
|
|
kDirectory,
|
|
};
|
|
Type type;
|
|
|
|
int64 size;
|
|
|
|
string content_mime_type;
|
|
|
|
string custom_icon_url;
|
|
|
|
// A URL to open the file in the Drive website.
|
|
string alternate_url;
|
|
|
|
// A URL to download the file.
|
|
string download_url;
|
|
|
|
mojo_base.mojom.Time modification_time;
|
|
mojo_base.mojom.Time modification_by_me_time;
|
|
|
|
bool available_offline;
|
|
bool dirty;
|
|
bool pinned;
|
|
bool shared;
|
|
bool starred;
|
|
|
|
// May be present if the file is an image.
|
|
ImageMetadata? image_metadata;
|
|
|
|
// The thumbnail as a PNG. It is only set if |want_thumbnail| is true in the
|
|
// request and the file has a thumbnail available.
|
|
array<uint8>? thumbnail;
|
|
|
|
Capabilities capabilities;
|
|
};
|
|
|
|
struct ImageMetadata {
|
|
// In pixels.
|
|
int32 height = 0;
|
|
int32 width = 0;
|
|
|
|
// Rotation in clockwise degrees.
|
|
int32 rotation = 0;
|
|
};
|
|
|
|
// Drive capabilities:
|
|
struct Capabilities {
|
|
bool can_share = true;
|
|
bool can_copy = true;
|
|
bool can_delete = true;
|
|
bool can_rename = true;
|
|
bool can_add_children = true;
|
|
};
|
|
|
|
struct ItemEvent {
|
|
enum State {
|
|
kQueued,
|
|
kInProgress,
|
|
kCompleted,
|
|
kFailed,
|
|
};
|
|
|
|
// The stable ID used by DriveFS.
|
|
int64 stable_id;
|
|
|
|
// A unique ID corresponding to a particular sync action.
|
|
int64 group_id;
|
|
|
|
string path;
|
|
|
|
State state;
|
|
|
|
// The following are valid only if |state| is kInProgress or kQueued. -1 acts
|
|
// as the sentinel value for unset.
|
|
int64 bytes_transferred = -1;
|
|
int64 bytes_to_transfer = -1;
|
|
};
|
|
|
|
struct SyncingStatus {
|
|
array<ItemEvent> item_events;
|
|
};
|
|
|
|
// A report of a server-side change to a file.
|
|
struct FileChange {
|
|
mojo_base.mojom.FilePath path;
|
|
|
|
enum Type {
|
|
kCreate,
|
|
kDelete,
|
|
kModify,
|
|
};
|
|
|
|
Type type;
|
|
};
|