1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
// Copyright 2022 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.cloud_upload.mojom;
// The selected action when the user closes the dialog.
enum UserAction {
kCancel,
kCancelGoogleDrive,
kCancelOneDrive,
kSetUpOneDrive,
kUploadToGoogleDrive,
kUploadToOneDrive,
kConfirmOrUploadToGoogleDrive,
kConfirmOrUploadToOneDrive,
};
// Used for metrics to represent each individual page of the dialog, and should
// be kept in sync with OfficeSetupPage in enums.xml. These values are
// persisted to logs. Entries should not be renumbered and numeric values should
// never be reused.
enum MetricsRecordedSetupPage {
kFileHandlerPage = 0,
kMoveConfirmationOneDrive = 1,
kMoveConfirmationGoogleDrive = 2,
kOneDriveSetupWelcome = 3,
kOneDriveSetupPWAInstall = 4,
kOneDriveSetupODFSMount = 5,
kOneDriveSetupComplete = 6,
};
// Operation used to upload the source file.
enum OperationType {
kMove,
kCopy,
};
// A local file task that is displayed in the `kFileHandlerDialog` which the
// user could select to open the files. The `position` is the tasks position
// in a vector with the other `DialogTask`s.
struct DialogTask {
int32 position;
string title;
string app_id;
string icon_url;
};
struct OneDriveSetupDialogArgs {
// True if the setup flow should end with setting Microsoft 365 as default
// handler.
bool set_office_as_default_handler;
};
struct MoveConfirmationOneDriveDialogArgs {
// Indicates what operation is used to upload the source file (copy or move).
OperationType operation_type;
};
struct MoveConfirmationGoogleDriveDialogArgs {
// Indicates what operation is used to upload the source file (copy or move).
OperationType operation_type;
};
struct ConnectToOneDriveDialogArgs {};
struct FileHandlerDialogArgs {
// The local file tasks the user can pick from to open the files. Displayed in
// the `kFileHandlerDialog` dialog.
array<DialogTask> local_tasks;
// Whether Google Workspace should be displayed in the `kFileHandlerDialog`
// dialog.
bool show_google_workspace_task;
// Whether Microsoft 365 should be displayed in the `kFileHandlerDialog`
// dialog.
bool show_microsoft_office_task;
};
union DialogSpecificArgs {
FileHandlerDialogArgs file_handler_dialog_args;
OneDriveSetupDialogArgs one_drive_setup_dialog_args;
MoveConfirmationOneDriveDialogArgs move_confirmation_one_drive_dialog_args;
MoveConfirmationGoogleDriveDialogArgs
move_confirmation_google_drive_dialog_args;
ConnectToOneDriveDialogArgs connect_to_one_drive_dialog_args;
};
// Contains the arguments used to set up the dialog.
struct DialogArgs {
// List of files that will be uploaded on dialog close if the user completes
// the setup. May be empty if the dialog wasn't initiated from a file handler.
array<string> file_names;
// Contains arguments specific to the given dialog.
DialogSpecificArgs dialog_specific_args;
};
// Lives in the browser process. A renderer uses this to create a page handler
// that enables communication between a renderer and the browser process.
interface PageHandlerFactory {
// Creates a page handler to enable communication with the browser process.
CreatePageHandler(pending_receiver<PageHandler> handler);
};
// Lives in the browser process. A renderer uses this to invoke methods that
// are implemented in the browser process.
interface PageHandler {
// Returns arguments passed to the dialog on creation. Might return nothing if
// called outside of a normal flow (say, when opening chrome://cloud-upload
// directly in the browser).
GetDialogArgs() => (DialogArgs? args);
// Returns whether or not the Office web app is installed.
IsOfficeWebAppInstalled() => (bool installed);
// Attempts to install the Office web app. Returns whether the web app
// successfully installed or was already installed.
InstallOfficeWebApp() => (bool installed);
// Returns whether or not the OneDrive filesystem is mounted.
IsODFSMounted() => (bool mounted);
// Starts the OneDrive authentication process.
SignInToOneDrive() => (bool success);
// Returns the user selected action and requests the dialog to be closed.
RespondWithUserActionAndClose(UserAction response);
// Returns the user selected local file task to launch and requests the
// dialog to be closed.
RespondWithLocalTaskAndClose(int32 task_position);
// Set Office as the default file handler for office files and mark the
// setup as complete so that it does not need to be started again.
SetOfficeAsDefaultHandler();
// Get the preference for whether we should always move office files to
// Google Drive without asking the user first.
GetAlwaysMoveOfficeFilesToDrive() => (bool always_move);
// Set the preference for whether we should always move office files to
// Google Drive without asking the user first.
SetAlwaysMoveOfficeFilesToDrive(bool always_move);
// Get the preference for whether we should always move office files to
// OneDrive without asking the user first.
GetAlwaysMoveOfficeFilesToOneDrive() => (bool always_move);
// Set the preference for whether we should always move office files to
// OneDrive without asking the user first.
SetAlwaysMoveOfficeFilesToOneDrive(bool always_move);
// Get the preference for whether the move to Drive confirmation dialog has
// been shown before.
GetOfficeMoveConfirmationShownForDrive() => (bool move_confirmation_shown);
// Get the preference for whether the move to OneDrive confirmation dialog
// has been shown before.
GetOfficeMoveConfirmationShownForOneDrive() => (bool move_confirmation_shown);
// Records the page at which the setup was cancelled.
RecordCancel(MetricsRecordedSetupPage page);
};
|