OLD | NEW |
1 // Copyright (c) 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 API is currently only implemented for | 6 // access data of the clipboard. This is a temporary solution for |
7 // ChromeOS. | 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. |
| 9 [platforms=("chromeos"), |
| 10 implemented_in="extensions/browser/api/clipboard/clipboard_api.h"] |
8 namespace clipboard { | 11 namespace clipboard { |
| 12 // Supported image types. |
| 13 enum ImageType {png, jpeg}; |
| 14 |
9 interface Events { | 15 interface Events { |
10 // Fired when clipboard data changes. | 16 // Fired when clipboard data changes. |
11 // Requires clipboard and clipboardRead permissions for adding listener to | 17 // Requires clipboard and clipboardRead permissions for adding listener to |
12 // chrome.clipboard.onClipboardDataChanged event. | 18 // chrome.clipboard.onClipboardDataChanged event. |
13 // After this event fires, the clipboard data is available by calling | 19 // After this event fires, the clipboard data is available by calling |
14 // document.execCommand('paste'). | 20 // document.execCommand('paste'). |
15 static void onClipboardDataChanged(); | 21 static void onClipboardDataChanged(); |
16 }; | 22 }; |
| 23 |
| 24 callback SetImageDataCallback = void(); |
| 25 |
| 26 interface Functions { |
| 27 // Sets image data to clipboard. |
| 28 // |
| 29 // |image_data|: The encoded image data. |
| 30 // |type|: The type of image being passed. |
| 31 // The callback is called with <code>chrome.runtime.lastError</code> |
| 32 // set to error code if there is an error. |
| 33 // Requires clipboard and clipboardWrite permissions. |
| 34 static void setImageData(ArrayBuffer image_data, |
| 35 ImageType type, |
| 36 SetImageDataCallback callback); |
| 37 }; |
17 }; | 38 }; |
OLD | NEW |