naiveproxy/content/common/clipboard.mojom
2018-01-28 13:32:06 -05:00

86 lines
2.9 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 content.mojom;
import "mojo/common/string16.mojom";
import "ui/base/clipboard/mojom/clipboard.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
import "url/mojo/url.mojom";
enum ClipboardFormat {
kPlaintext,
kHtml,
kSmartPaste,
kBookmark,
};
interface ClipboardHost {
[Sync]
GetSequenceNumber(ui.mojom.ClipboardType type) => (uint64 result);
[Sync]
IsFormatAvailable(ClipboardFormat format,
ui.mojom.ClipboardType type) => (bool result);
[Sync]
ReadAvailableTypes(ui.mojom.ClipboardType type) =>
(array<mojo.common.mojom.String16> types, bool result);
[Sync]
ReadText(ui.mojom.ClipboardType type) => (mojo.common.mojom.String16 result);
[Sync]
ReadHtml(ui.mojom.ClipboardType type) => (mojo.common.mojom.String16 markup,
url.mojom.Url url,
uint32 fragment_start,
uint32 fragment_end);
[Sync]
ReadRtf(ui.mojom.ClipboardType type) => (string result);
[Sync]
ReadImage(ui.mojom.ClipboardType type) => (string blob_uuid,
string mime_type,
int64 size);
[Sync]
ReadCustomData(ui.mojom.ClipboardType clipboard_type,
mojo.common.mojom.String16 type) =>
(mojo.common.mojom.String16 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(ui.mojom.ClipboardType type, mojo.common.mojom.String16 text);
WriteHtml(ui.mojom.ClipboardType type,
mojo.common.mojom.String16 markup,
url.mojom.Url url);
WriteSmartPasteMarker(ui.mojom.ClipboardType type);
WriteCustomData(
ui.mojom.ClipboardType type,
map<mojo.common.mojom.String16, mojo.common.mojom.String16> 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(ui.mojom.ClipboardType type,
string url,
mojo.common.mojom.String16 title);
WriteImage(ui.mojom.ClipboardType type,
gfx.mojom.Size size_in_pixels,
handle<shared_buffer> shared_buffer_handle);
CommitWrite(ui.mojom.ClipboardType type);
// OS_MACOSX only
WriteStringToFindPboard(mojo.common.mojom.String16 text);
};