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

Side by Side Diff: ui/base/clipboard/clipboard_gtk.cc

Issue 9447047: Fix copying from Java AWT app and pasting into Chrome on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/base/clipboard/clipboard.h" 5 #include "ui/base/clipboard/clipboard.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <X11/extensions/Xfixes.h> 8 #include <X11/extensions/Xfixes.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <map> 10 #include <map>
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 bool retval = false; 361 bool retval = false;
362 GtkSelectionData* data = gtk_clipboard_wait_for_contents( 362 GtkSelectionData* data = gtk_clipboard_wait_for_contents(
363 clipboard, gdk_atom_intern_static_string("TARGETS")); 363 clipboard, gdk_atom_intern_static_string("TARGETS"));
364 364
365 bool format_is_plain_text = GetPlainTextFormatType().Equals(format); 365 bool format_is_plain_text = GetPlainTextFormatType().Equals(format);
366 if (format_is_plain_text) { 366 if (format_is_plain_text) {
367 // This tries a number of common text targets. 367 // This tries a number of common text targets.
368 if (data) { 368 if (data) {
369 retval = gtk_selection_data_targets_include_text(data); 369 retval = gtk_selection_data_targets_include_text(data);
370 } else { 370 }
371 // Some programs like Java decide to set an empty TARGETS list, so even if
372 // data is not NULL, we still have to fall back.
373 if (!retval) {
371 // Some programs post data to the clipboard without any targets. If this 374 // Some programs post data to the clipboard without any targets. If this
372 // is the case we attempt to make sense of the contents as text. This is 375 // is the case we attempt to make sense of the contents as text. This is
373 // pretty unfortunate since it means we have to actually copy the data to 376 // pretty unfortunate since it means we have to actually copy the data to
374 // see if it is available, but at least this path shouldn't be hit for 377 // see if it is available, but at least this path shouldn't be hit for
375 // conforming programs. 378 // conforming programs.
376 gchar* text = gtk_clipboard_wait_for_text(clipboard); 379 gchar* text = gtk_clipboard_wait_for_text(clipboard);
377 if (text) { 380 if (text) {
378 g_free(text); 381 g_free(text);
379 retval = true; 382 retval = true;
380 } 383 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 return clipboard_; 632 return clipboard_;
630 case BUFFER_SELECTION: 633 case BUFFER_SELECTION:
631 return primary_selection_; 634 return primary_selection_;
632 default: 635 default:
633 NOTREACHED(); 636 NOTREACHED();
634 return NULL; 637 return NULL;
635 } 638 }
636 } 639 }
637 640
638 } // namespace ui 641 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698