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_requestor.h" | 5 #include "ui/base/x/selection_requestor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 for (size_t i = 0; i < data.size(); ++i) | 47 for (size_t i = 0; i < data.size(); ++i) |
48 length += data[i]->size(); | 48 length += data[i]->size(); |
49 std::vector<unsigned char> combined_data; | 49 std::vector<unsigned char> combined_data; |
50 combined_data.reserve(length); | 50 combined_data.reserve(length); |
51 | 51 |
52 for (size_t i = 0; i < data.size(); ++i) { | 52 for (size_t i = 0; i < data.size(); ++i) { |
53 combined_data.insert(combined_data.end(), | 53 combined_data.insert(combined_data.end(), |
54 data[i]->front(), | 54 data[i]->front(), |
55 data[i]->front() + data[i]->size()); | 55 data[i]->front() + data[i]->size()); |
56 } | 56 } |
57 return scoped_refptr<base::RefCountedMemory>( | 57 return base::RefCountedBytes::TakeVector(&combined_data); |
58 base::RefCountedBytes::TakeVector(&combined_data)); | |
59 } | 58 } |
60 | 59 |
61 } // namespace | 60 } // namespace |
62 | 61 |
63 SelectionRequestor::SelectionRequestor(XDisplay* x_display, | 62 SelectionRequestor::SelectionRequestor(XDisplay* x_display, |
64 XID x_window, | 63 XID x_window, |
65 PlatformEventDispatcher* dispatcher) | 64 PlatformEventDispatcher* dispatcher) |
66 : x_display_(x_display), | 65 : x_display_(x_display), |
67 x_window_(x_window), | 66 x_window_(x_window), |
68 x_property_(None), | 67 x_property_(None), |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 out_type(None), | 311 out_type(None), |
313 success(false), | 312 success(false), |
314 timeout(timeout), | 313 timeout(timeout), |
315 completed(false) { | 314 completed(false) { |
316 } | 315 } |
317 | 316 |
318 SelectionRequestor::Request::~Request() { | 317 SelectionRequestor::Request::~Request() { |
319 } | 318 } |
320 | 319 |
321 } // namespace ui | 320 } // namespace ui |
OLD | NEW |