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 #include "ui/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
6 | 6 |
7 #include <X11/extensions/Xfixes.h> | 7 #include <X11/extensions/Xfixes.h> |
8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
9 #include <list> | 9 #include <list> |
10 #include <set> | 10 #include <set> |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 scoped_refptr<base::RefCountedMemory> data; | 449 scoped_refptr<base::RefCountedMemory> data; |
450 size_t out_data_items = 0; | 450 size_t out_data_items = 0; |
451 ::Atom out_type = None; | 451 ::Atom out_type = None; |
452 | 452 |
453 SelectionRequestor* receiver = GetSelectionRequestorForClipboardType(type); | 453 SelectionRequestor* receiver = GetSelectionRequestorForClipboardType(type); |
454 if (receiver->PerformBlockingConvertSelection(atom_cache_.GetAtom(kTargets), | 454 if (receiver->PerformBlockingConvertSelection(atom_cache_.GetAtom(kTargets), |
455 &data, | 455 &data, |
456 NULL, | 456 NULL, |
457 &out_data_items, | 457 &out_data_items, |
458 &out_type)) { | 458 &out_type)) { |
459 if (out_type == XA_ATOM) { | 459 // Some apps return an |out_type| of "TARGETS". (crbug.com/377893) |
| 460 if (out_type == XA_ATOM || out_type == atom_cache_.GetAtom(kTargets)) { |
460 const ::Atom* atom_array = | 461 const ::Atom* atom_array = |
461 reinterpret_cast<const ::Atom*>(data->front()); | 462 reinterpret_cast<const ::Atom*>(data->front()); |
462 for (size_t i = 0; i < out_data_items; ++i) | 463 for (size_t i = 0; i < out_data_items; ++i) |
463 out.push_back(atom_array[i]); | 464 out.push_back(atom_array[i]); |
464 } | 465 } |
465 } else { | 466 } else { |
466 // There was no target list. Most Java apps doesn't offer a TARGETS list, | 467 // There was no target list. Most Java apps doesn't offer a TARGETS list, |
467 // even though they AWT to. They will offer individual text types if you | 468 // even though they AWT to. They will offer individual text types if you |
468 // ask. If this is the case we attempt to make sense of the contents as | 469 // ask. If this is the case we attempt to make sense of the contents as |
469 // text. This is pretty unfortunate since it means we have to actually | 470 // text. This is pretty unfortunate since it means we have to actually |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 return type; | 916 return type; |
916 } | 917 } |
917 | 918 |
918 // static | 919 // static |
919 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { | 920 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { |
920 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); | 921 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); |
921 return type; | 922 return type; |
922 } | 923 } |
923 | 924 |
924 } // namespace ui | 925 } // namespace ui |
OLD | NEW |