chromium/third_party/blink/renderer/modules/clipboard/clipboard.idl

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://w3c.github.io/clipboard-apis/#clipboard-interface

dictionary ClipboardUnsanitizedFormats {
  sequence<DOMString> unsanitized;
};

[
    SecureContext,
    Exposed=Window
] interface Clipboard : EventTarget {
    [MeasureAs=AsyncClipboardAPIRead,
     CallWith=ScriptState,
     RaisesException
    ] Promise<sequence<ClipboardItem>> read();

    [MeasureAs=AsyncClipboardAPIUnsanitizedRead,
     CallWith=ScriptState,
     RaisesException
    ] Promise<sequence<ClipboardItem>> read(ClipboardUnsanitizedFormats formats);

    [MeasureAs=AsyncClipboardAPIReadText,
     CallWith=ScriptState,
     RaisesException
    ] Promise<DOMString> readText();


    [MeasureAs=AsyncClipboardAPIWrite,
     CallWith=ScriptState,
     RaisesException
    ] Promise<undefined> write(sequence<ClipboardItem> data);

    [MeasureAs=AsyncClipboardAPIWriteText,
     CallWith=ScriptState,
     RaisesException
    ] Promise<undefined> writeText(DOMString data);
};