Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: remoting/webapp/crd/js/clipboard.js

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused types Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 this.blockOneClipboardSend_ = true; 63 this.blockOneClipboardSend_ = true;
64 this.initiateToHost(); 64 this.initiateToHost();
65 }; 65 };
66 66
67 /** 67 /**
68 * Accepts a clipboard from the OS, and sends any changed clipboard items to 68 * Accepts a clipboard from the OS, and sends any changed clipboard items to
69 * the host. 69 * the host.
70 * 70 *
71 * Currently only text items are supported. 71 * Currently only text items are supported.
72 * 72 *
73 * @param {remoting.ClipboardData} clipboardData 73 * @param {ClipboardData} clipboardData
74 * @return {void} Nothing. 74 * @return {void} Nothing.
75 */ 75 */
76 remoting.Clipboard.prototype.toHost = function(clipboardData) { 76 remoting.Clipboard.prototype.toHost = function(clipboardData) {
77 if (!clipboardData || !clipboardData.types || !clipboardData.getData) { 77 if (!clipboardData || !clipboardData.types || !clipboardData.getData) {
78 console.log('Got invalid clipboardData.'); 78 console.log('Got invalid clipboardData.');
79 return; 79 return;
80 } 80 }
81 if (!remoting.clientSession) { 81 if (!remoting.clientSession) {
82 return; 82 return;
83 } 83 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return; 130 return;
131 } 131 }
132 this.previousContent = item; 132 this.previousContent = item;
133 this.itemFromHostTextPending = true; 133 this.itemFromHostTextPending = true;
134 this.initiateToOs(); 134 this.initiateToOs();
135 }; 135 };
136 136
137 /** 137 /**
138 * Moves any pending clipboard items to a ClipboardData object. 138 * Moves any pending clipboard items to a ClipboardData object.
139 * 139 *
140 * @param {remoting.ClipboardData} clipboardData 140 * @param {ClipboardData} clipboardData
141 * @return {boolean} Whether any clipboard items were moved to the ClipboardData 141 * @return {boolean} Whether any clipboard items were moved to the ClipboardData
142 * object. 142 * object.
143 */ 143 */
144 remoting.Clipboard.prototype.toOs = function(clipboardData) { 144 remoting.Clipboard.prototype.toOs = function(clipboardData) {
145 if (!this.itemFromHostTextPending) { 145 if (!this.itemFromHostTextPending) {
146 console.log('Got unexpected clipboard copy event.'); 146 console.log('Got unexpected clipboard copy event.');
147 return false; 147 return false;
148 } 148 }
149 // The JSON layer between the plugin and this webapp converts UTF-8 to the 149 // The JSON layer between the plugin and this webapp converts UTF-8 to the
150 // JS string encoding. The browser will convert JS strings to the correct 150 // JS string encoding. The browser will convert JS strings to the correct
(...skipping 30 matching lines...) Expand all
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;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698