Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // The <code>chrome.clipboard</code> API is provided to allow users to | 5 // The <code>chrome.clipboard</code> API is provided to allow users to |
| 6 // access data of the clipboard. This is a temporary solution for | 6 // access data of the clipboard. This is a temporary solution for |
| 7 // chromeos platform apps until open-web alternative is available. It will be | 7 // chromeos platform apps until open-web alternative is available. It will be |
| 8 // deprecated once open-web solution is available, which could be in 2017 Q2. | 8 // deprecated once open-web solution is available, which could be in 2017 Q4. |
| 9 [platforms=("chromeos"), | 9 [platforms=("chromeos"), |
| 10 implemented_in="extensions/browser/api/clipboard/clipboard_api.h"] | 10 implemented_in="extensions/browser/api/clipboard/clipboard_api.h"] |
| 11 namespace clipboard { | 11 namespace clipboard { |
| 12 // Supported image types. | 12 // Supported image types. |
| 13 enum ImageType {png, jpeg}; | 13 enum ImageType {png, jpeg}; |
| 14 | 14 |
| 15 enum DataItemType {textPlain, textHtml}; | |
| 16 | |
| 17 // Additional data item to be added along with the |image_data| to describe | |
| 18 // the |image_data|. | |
| 19 dictionary AdditionalDataItem { | |
| 20 // MIME type of the additional data item, supported types are: | |
| 21 // "textPlain" and "textHtml". | |
|
Devlin
2017/05/23 17:04:47
We don't need to specify the supported types, sinc
jennyz
2017/05/23 21:36:39
Done.
| |
| 22 DataItemType type; | |
| 23 | |
| 24 // Content of the additional data item. Either the plain text string if | |
| 25 // |type| is "textPlain" or markup string if |type| is "textHtml". The | |
| 26 // data can not exceed 2MB. | |
| 27 DOMString data; | |
| 28 }; | |
| 29 | |
| 15 interface Events { | 30 interface Events { |
| 16 // Fired when clipboard data changes. | 31 // Fired when clipboard data changes. |
| 17 // Requires clipboard and clipboardRead permissions for adding listener to | 32 // Requires clipboard and clipboardRead permissions for adding listener to |
| 18 // chrome.clipboard.onClipboardDataChanged event. | 33 // chrome.clipboard.onClipboardDataChanged event. |
| 19 // After this event fires, the clipboard data is available by calling | 34 // After this event fires, the clipboard data is available by calling |
| 20 // document.execCommand('paste'). | 35 // document.execCommand('paste'). |
| 21 static void onClipboardDataChanged(); | 36 static void onClipboardDataChanged(); |
| 22 }; | 37 }; |
| 23 | 38 |
| 24 callback SetImageDataCallback = void(); | 39 callback SetImageDataCallback = void(); |
| 25 | 40 |
| 26 interface Functions { | 41 interface Functions { |
| 27 // Sets image data to clipboard. | 42 // Sets image data to clipboard. |
| 28 // | 43 // |
| 29 // |image_data|: The encoded image data. | 44 // |imageData|: The encoded image data. |
| 30 // |type|: The type of image being passed. | 45 // |type|: The type of image being passed. |
| 46 // |additionalItems|: Additional data items for describing image data. | |
| 31 // The callback is called with <code>chrome.runtime.lastError</code> | 47 // The callback is called with <code>chrome.runtime.lastError</code> |
| 32 // set to error code if there is an error. | 48 // set to error code if there is an error. |
| 33 // Requires clipboard and clipboardWrite permissions. | 49 // Requires clipboard and clipboardWrite permissions. |
| 34 static void setImageData(ArrayBuffer image_data, | 50 static void setImageData(ArrayBuffer imageData, |
| 35 ImageType type, | 51 ImageType type, |
| 52 optional AdditionalDataItem[] additionalItems, | |
| 36 SetImageDataCallback callback); | 53 SetImageDataCallback callback); |
| 37 }; | 54 }; |
| 38 }; | 55 }; |
| OLD | NEW |