• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5module mojo {
6
7// A wrapper type which is just a Key/Value pair. Workaround until we get
8// proper maps in mojom.
9struct MimeTypePair {
10  string mime_type;
11  uint8[] data;
12};
13
14interface Clipboard {
15  enum Type {
16    COPY_PASTE = 0,
17    SELECTION = 1,
18    DRAG = 2
19  };
20
21  // Mime type constants
22  const string MIME_TYPE_TEXT = "text/plain";
23  const string MIME_TYPE_HTML = "text/html";
24  const string MIME_TYPE_URL = "text/url";
25
26  // Returns a sequence number which uniquely identifies clipboard state.
27  // Clients are able to assume that the clipboard contents are unchanged as
28  // long as this number has not changed. This number is monotonically
29  // increasing, is increased when the clipboard state changes, and is
30  // provided by Windows, Linux, and Mac.
31  GetSequenceNumber(Type clipboard_type) => (uint64 sequence);
32
33  // Returns the available mime types. (Note: the chrome interface has a
34  // |contains_filenames| parameter here, but it appears to always be set
35  // to false.)
36  GetAvailableMimeTypes(Type clipboard_types) => (string[] types);
37
38  // Returns the data associated with a Mime type, returning NULL if that data
39  // doesn't exist. Note: because of the inherit raciness of clipboard access,
40  // this may return NULL even if you just verified that it exists with
41  // GetAvailableFormatMimeTypes(). We don't want to provide one API to return
42  // the entire clipboard state because the combined size of the clipboard can
43  // be megabytes, especially when image data is involved.
44  ReadMimeType(Type clipboard_type, string mime_type) => (uint8[]? data);
45
46  // Writes a set of mime types to the clipboard. This will increment the
47  // sequence number. In the case of an empty or NULL list, this will just
48  // clear the clipboard.
49  WriteClipboardData(Type clipboard_type, MimeTypePair[]? data);
50};
51
52}  // module mojo
53