| // 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. |
| |
| module blink.mojom; |
| |
| import "mojo/public/mojom/base/file_path.mojom"; |
| import "mojo/public/mojom/base/big_buffer.mojom"; |
| import "mojo/public/mojom/base/string16.mojom"; |
| import "services/network/public/mojom/referrer_policy.mojom"; |
| import "ui/base/dragdrop/mojom/drag_drop_types.mojom"; |
| import "ui/gfx/geometry/mojom/geometry.mojom"; |
| import "url/mojom/url.mojom"; |
| import "third_party/blink/public/mojom/data_transfer/data_transfer.mojom"; |
| |
| // This struct encodes what drag-and-drop operations are allowed. It's |
| // typemapped to blink::DragOperationsMask. |
| // TODO(https://crbug.com/1082291): Change this to a bitset if/when mojom |
| // supports bitset types. |
| struct AllowedDragOperations { |
| bool allow_copy; |
| bool allow_link; |
| bool allow_move; |
| }; |
| |
| // Used when dragging images, links, plain text, HTML content or other |
| // arbitrary data. |
| struct DragItemString { |
| // Mime type of the dragged data. |
| string string_type; |
| // Depending of the value of `string_type`, it contains the dragged link, |
| // text, HTML markup or any other data. |
| mojo_base.mojom.BigString16 string_data; |
| |
| // Title associated with a link. Only valid when string_type == "text/uri-list". |
| mojo_base.mojom.String16? title; |
| |
| // Stores the base URL for the contained markup. Only valid when string_type |
| // == "text/html". |
| url.mojom.Url? base_url; |
| }; |
| |
| // Only used when dragging images out of Blink. |
| struct DragItemBinary { |
| // Image data. |
| mojo_base.mojom.BigBuffer data; |
| url.mojom.Url source_url; |
| mojo_base.mojom.FilePath filename_extension; |
| // Content-Disposition response header. |
| string? content_disposition; |
| }; |
| |
| // Used for dragging files using the FileSystem API. |
| struct DragItemFileSystemFile { |
| url.mojom.Url url; |
| int64 size; |
| string? file_system_id; |
| }; |
| |
| union DragItem { |
| DragItemString string; |
| DataTransferFile file; |
| DragItemBinary binary; |
| DragItemFileSystemFile file_system_file; |
| }; |
| |
| // Holds data that may be exchanged through a drag-n-drop operation. |
| struct DragData { |
| array<DragItem> items; |
| string? file_system_id; // Only used when dragging into Blink to represent a |
| // new isolated file system to access the dropped |
| // files. |
| |
| // Used for DragItemString when string_type == "downloadurl". |
| network.mojom.ReferrerPolicy referrer_policy = |
| network.mojom.ReferrerPolicy.kDefault; |
| }; |
| |
| // Information about the event that started a drag session. |
| struct DragEventSourceInfo { |
| gfx.mojom.Point location; |
| ui.mojom.DragEventSource source; |
| }; |