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

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

Issue 9703003: [Chromoting] Let the webapp detect new clipboard text items when it gets focus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/remoting.gyp ('k') | remoting/webapp/clipboard_event_proto.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * A class for moving clipboard items between the plugin and the OS.
8 */
9
10 'use strict';
11
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
14
15 /**
16 * @constructor
17 */
18 remoting.Clipboard = function() {
19 };
20
21 /**
22 * @private
23 * @enum {string}
24 */
25 remoting.Clipboard.prototype.ItemTypes = {
26 TEXT_TYPE: 'text/plain'
27 };
28
29 /**
30 * @private
31 * @type {string}
32 */
33 remoting.Clipboard.prototype.recentItemText = "";
34
35 /**
36 * Accepts a clipboard from the OS, and sends any changed clipboard items to
37 * the host.
38 *
39 * Currently only text items are supported.
40 *
41 * @param {remoting.ClipboardData} clipboardData
42 * @return {void} Nothing.
43 */
44 remoting.Clipboard.prototype.toHost = function(clipboardData) {
45 if (!clipboardData || !clipboardData.types || !clipboardData.getData) {
46 return;
47 }
48 var textType = 'text/plain';
49 for (var i = 0; i < clipboardData.types.length; i++) {
50 var type = clipboardData.types[i];
51 if (type == this.ItemTypes.TEXT_TYPE) {
52 var item = clipboardData.getData(type);
53 if (!item) {
54 item = "";
55 }
56 if (item != this.recentItemText) {
57 // TODO(simonmorris): Pass the clipboard text item to the plugin.
58 this.recentItemText = item;
59 }
60 }
61 }
62 };
63
64 /** @type {remoting.Clipboard} */
65 remoting.clipboard = null;
OLDNEW
« no previous file with comments | « remoting/remoting.gyp ('k') | remoting/webapp/clipboard_event_proto.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698