naiveproxy/third_party/blink/public/mojom/clipboard/clipboard.mojom
2018-08-11 05:35:24 +00:00

96 lines
3.1 KiB
Plaintext

// Copyright 2017 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/string16.mojom";
import "third_party/blink/public/mojom/blob/serialized_blob.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
import "url/mojom/url.mojom";
enum ClipboardFormat {
kPlaintext,
kHtml,
kSmartPaste,
kBookmark,
};
enum ClipboardBuffer {
kStandard,
// Used on platforms like the X Window System that treat selection
// as a type of clipboard.
// TODO(crbug.com/676224): When preprocessing of mojom is available only
// define this value for USE_X11.
kSelection,
};
interface ClipboardHost {
[Sync]
GetSequenceNumber(blink.mojom.ClipboardBuffer buffer) => (uint64 result);
[Sync]
IsFormatAvailable(blink.mojom.ClipboardFormat format,
blink.mojom.ClipboardBuffer buffer) => (bool result);
[Sync]
ReadAvailableTypes(blink.mojom.ClipboardBuffer buffer) =>
(array<mojo_base.mojom.String16> types, bool result);
[Sync]
ReadText(blink.mojom.ClipboardBuffer buffer) =>
(mojo_base.mojom.BigString16 result);
[Sync]
ReadHtml(blink.mojom.ClipboardBuffer buffer) =>
(mojo_base.mojom.BigString16 markup,
url.mojom.Url url,
uint32 fragment_start,
uint32 fragment_end);
[Sync]
ReadRtf(blink.mojom.ClipboardBuffer buffer) => (string result);
[Sync]
ReadImage(blink.mojom.ClipboardBuffer buffer) => (SerializedBlob? blob);
[Sync]
ReadCustomData(blink.mojom.ClipboardBuffer buffer,
mojo_base.mojom.String16 type) =>
(mojo_base.mojom.BigString16 result);
// Writing to the clipboard via IPC is a two-phase operation. First, the
// sender sends the different types of data it'd like to write to the
// receiver. Then, it sends a commit message to commit the data to the system
// clipboard.
WriteText(blink.mojom.ClipboardBuffer buffer,
mojo_base.mojom.BigString16 text);
WriteHtml(blink.mojom.ClipboardBuffer buffer,
mojo_base.mojom.BigString16 markup,
url.mojom.Url url);
WriteSmartPasteMarker(blink.mojom.ClipboardBuffer buffer);
WriteCustomData(
blink.mojom.ClipboardBuffer buffer,
map<mojo_base.mojom.String16, mojo_base.mojom.BigString16> data);
// TODO(dcheng): The |url| parameter should really be a GURL, but <canvas>'s
// copy as image tries to set very long data: URLs on the clipboard. Using
// GURL causes the browser to kill the renderer for sending a bad IPC (GURLs
// bigger than 2 megabytes are considered to be bad). https://crbug.com/459822
WriteBookmark(blink.mojom.ClipboardBuffer buffer,
string url,
mojo_base.mojom.String16 title);
WriteImage(blink.mojom.ClipboardBuffer buffer,
gfx.mojom.Size size_in_pixels,
handle<shared_buffer> shared_buffer_handle);
CommitWrite(blink.mojom.ClipboardBuffer buffer);
[EnableIf=is_mac]
WriteStringToFindPboard(mojo_base.mojom.String16 text);
};