| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * A class for moving clipboard items between the plugin and the OS. | 7 * A class for moving clipboard items between the plugin and the OS. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 * Initiates the process of sending any fresh items on the OS clipboard, to the | 160 * Initiates the process of sending any fresh items on the OS clipboard, to the |
| 161 * host. | 161 * host. |
| 162 * | 162 * |
| 163 * This method makes the browser fire a paste event, which provides access to | 163 * This method makes the browser fire a paste event, which provides access to |
| 164 * the OS clipboard. That event will be caught by a handler in the document, | 164 * the OS clipboard. That event will be caught by a handler in the document, |
| 165 * which will call toHost(). | 165 * which will call toHost(). |
| 166 */ | 166 */ |
| 167 remoting.Clipboard.prototype.initiateToHost = function() { | 167 remoting.Clipboard.prototype.initiateToHost = function() { |
| 168 // It would be cleaner to send a paste command to the plugin element, | 168 // It would be cleaner to send a paste command to the plugin element, |
| 169 // but that's not supported. | 169 // but that's not supported. |
| 170 console.log('Initiating clipboard paste.'); | 170 //console.log('Initiating clipboard paste.'); |
| 171 document.execCommand("paste"); | 171 document.execCommand("paste"); |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 /** | 174 /** |
| 175 * Initiates the process of sending any items freshly received from the host, | 175 * Initiates the process of sending any items freshly received from the host, |
| 176 * to the OS clipboard. | 176 * to the OS clipboard. |
| 177 * | 177 * |
| 178 * This method makes the browser fire a copy event, which provides access to | 178 * This method makes the browser fire a copy event, which provides access to |
| 179 * the OS clipboard. That event will be caught by a handler in the document, | 179 * the OS clipboard. That event will be caught by a handler in the document, |
| 180 * which will call toOs(). | 180 * which will call toOs(). |
| 181 */ | 181 */ |
| 182 remoting.Clipboard.prototype.initiateToOs = function() { | 182 remoting.Clipboard.prototype.initiateToOs = function() { |
| 183 // It would be cleaner to send a paste command to the plugin element, | 183 // It would be cleaner to send a paste command to the plugin element, |
| 184 // but that's not supported. | 184 // but that's not supported. |
| 185 console.log('Initiating clipboard copy.'); | 185 console.log('Initiating clipboard copy.'); |
| 186 document.execCommand("copy"); | 186 document.execCommand("copy"); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 /** @type {remoting.Clipboard} */ | 189 /** @type {remoting.Clipboard} */ |
| 190 remoting.clipboard = null; | 190 remoting.clipboard = null; |
| OLD | NEW |