naiveproxy/third_party/blink/public/mojom/clipboard/clipboard.mojom
2018-08-14 22:19:20 +00:00

90 lines
2.8 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 "skia/public/interfaces/bitmap.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(ClipboardBuffer buffer) => (uint64 result);
[Sync]
IsFormatAvailable(ClipboardFormat format,
ClipboardBuffer buffer) => (bool result);
[Sync]
ReadAvailableTypes(ClipboardBuffer buffer) =>
(array<mojo_base.mojom.String16> types, bool result);
[Sync]
ReadText(ClipboardBuffer buffer) => (mojo_base.mojom.BigString16 result);
[Sync]
ReadHtml(ClipboardBuffer buffer) => (mojo_base.mojom.BigString16 markup,
url.mojom.Url url,
uint32 fragment_start,
uint32 fragment_end);
[Sync]
ReadRtf(ClipboardBuffer buffer) => (string result);
[Sync]
ReadImage(ClipboardBuffer buffer) => (skia.mojom.Bitmap? image);
[Sync]
ReadCustomData(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.
// TODO(dcheng): Remove |buffer| parameters from Write* functions.
WriteText(ClipboardBuffer buffer, mojo_base.mojom.BigString16 text);
WriteHtml(ClipboardBuffer buffer,
mojo_base.mojom.BigString16 markup,
url.mojom.Url url);
WriteSmartPasteMarker(ClipboardBuffer buffer);
WriteCustomData(
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(ClipboardBuffer buffer,
string url,
mojo_base.mojom.String16 title);
WriteImage(ClipboardBuffer buffer, skia.mojom.Bitmap image);
CommitWrite(ClipboardBuffer buffer);
[EnableIf=is_mac]
WriteStringToFindPboard(mojo_base.mojom.String16 text);
};