Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 5 module mojo { | |
| 6 | |
| 7 interface Clipboard { | |
| 8 enum Type { | |
| 9 COPY_PASTE, | |
| 10 SELECTION, | |
| 11 DRAG | |
| 12 }; | |
| 13 | |
| 14 // Mime type constants | |
| 15 const string MIME_TYPE_TEXT = "text/plain"; | |
| 16 const string MIME_TYPE_HTML = "text/html"; | |
| 17 | |
| 18 // Returns a sequence number which uniquely identifies clipboard state. This | |
| 19 // number is monotonically increasing, is increased when the clipboard state | |
| 20 // changes, and is provided by all major operating systems (Win, Linux, Mac). | |
|
sky
2014/09/11 22:11:43
nit: no need to say provided by all major OSs here
| |
| 21 GetSequenceNumber(Type clipboard_type) => (uint64 sequence); | |
| 22 | |
| 23 // Returns the available mime types. (Note: the chrome interface has a | |
| 24 // |contains_filenames| parameter here, but it appears to always be set | |
| 25 // to false.) | |
| 26 GetAvailableFormatMimeTypes(Type clipboard_types) => (string[] types); | |
| 27 | |
| 28 ReadPlainText(Type clipboard_type) => (string text); | |
|
sky
2014/09/11 22:11:43
Seems like the return type should be nullable. In
| |
| 29 ReadHTML(Type clipboard_type) => | |
|
sky
2014/09/11 22:11:43
Can html and plain text be expressed as a mime typ
| |
| 30 (string html, string url, uint32 fragment_start, uint32 fragment_end); | |
| 31 ReadMIMEType(Type clipboard_type, string mime_type) => (string data); | |
| 32 // TODO: We probably want an image type. | |
| 33 | |
| 34 // Clipboard Writing | |
| 35 // | |
| 36 // Clipboard writing is a two phase operation, where a client queues all data | |
| 37 // types that they want written to the clipboard, and then writes all queued | |
| 38 // data in one pass. We do this to prevent racing with other applications on | |
| 39 // the system. | |
| 40 | |
| 41 // Queue writing individual datatypes to specific clipboards. | |
| 42 QueueWritePlainText(Type clipboard_type, string text); | |
|
sky
2014/09/11 22:11:43
Two staged commit seems best done in the client. C
| |
| 43 QueueWriteHTML(Type clipboard_type, string html_text, string url); | |
| 44 QueueWriteMIMEType(Type clipboard_type, string mime_type, string data); | |
| 45 // TODO: We probably want an image type. | |
| 46 | |
| 47 // Writes all queued data types in one pass. | |
| 48 WriteQueuedData(Type clipboard_type); | |
| 49 }; | |
| 50 | |
| 51 } // module mojo | |
| OLD | NEW |