| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/x/selection_owner.h" | 5 #include "ui/base/x/selection_owner.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 0, // offset into property data to | 70 0, // offset into property data to |
| 71 // read | 71 // read |
| 72 (~0L), // entire array | 72 (~0L), // entire array |
| 73 False, // deleted | 73 False, // deleted |
| 74 AnyPropertyType, | 74 AnyPropertyType, |
| 75 &type, | 75 &type, |
| 76 &format, | 76 &format, |
| 77 &num_items, | 77 &num_items, |
| 78 &remaining_bytes, | 78 &remaining_bytes, |
| 79 &properties); | 79 &properties); |
| 80 gfx::XScopedPtr<unsigned char> scoped_properties(properties); |
| 80 | 81 |
| 81 if (result != Success) | 82 if (result != Success) |
| 82 return false; | 83 return false; |
| 83 | 84 |
| 84 // GTK does not require |type| to be kAtomPair. | 85 // GTK does not require |type| to be kAtomPair. |
| 85 if (format != 32 || num_items % 2 != 0) { | 86 if (format != 32 || num_items % 2 != 0) |
| 86 XFree(properties); | |
| 87 return false; | 87 return false; |
| 88 } | |
| 89 | 88 |
| 90 XAtom* atom_properties = reinterpret_cast<XAtom*>(properties); | 89 XAtom* atom_properties = reinterpret_cast<XAtom*>(properties); |
| 91 value->clear(); | 90 value->clear(); |
| 92 for (size_t i = 0; i < num_items; i+=2) | 91 for (size_t i = 0; i < num_items; i+=2) |
| 93 value->push_back(std::make_pair(atom_properties[i], atom_properties[i+1])); | 92 value->push_back(std::make_pair(atom_properties[i], atom_properties[i+1])); |
| 94 XFree(properties); | |
| 95 return true; | 93 return true; |
| 96 } | 94 } |
| 97 | 95 |
| 98 } // namespace | 96 } // namespace |
| 99 | 97 |
| 100 SelectionOwner::SelectionOwner(XDisplay* x_display, | 98 SelectionOwner::SelectionOwner(XDisplay* x_display, |
| 101 XID x_window, | 99 XID x_window, |
| 102 XAtom selection_name) | 100 XAtom selection_name) |
| 103 : x_display_(x_display), | 101 : x_display_(x_display), |
| 104 x_window_(x_window), | 102 x_window_(x_window), |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 data(data), | 373 data(data), |
| 376 offset(offset), | 374 offset(offset), |
| 377 timeout(timeout), | 375 timeout(timeout), |
| 378 foreign_window_manager_id(foreign_window_manager_id) { | 376 foreign_window_manager_id(foreign_window_manager_id) { |
| 379 } | 377 } |
| 380 | 378 |
| 381 SelectionOwner::IncrementalTransfer::~IncrementalTransfer() { | 379 SelectionOwner::IncrementalTransfer::~IncrementalTransfer() { |
| 382 } | 380 } |
| 383 | 381 |
| 384 } // namespace ui | 382 } // namespace ui |
| OLD | NEW |