| 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 16 matching lines...) Expand all Loading... |
| 27 NULL | 27 NULL |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // The period of |abort_timer_|. Arbitrary but must be <= than | 30 // The period of |abort_timer_|. Arbitrary but must be <= than |
| 31 // kRequestTimeoutMs. | 31 // kRequestTimeoutMs. |
| 32 const int kTimerPeriodMs = 100; | 32 const int kTimerPeriodMs = 100; |
| 33 | 33 |
| 34 // The amount of time to wait for a request to complete before aborting it. | 34 // The amount of time to wait for a request to complete before aborting it. |
| 35 const int kRequestTimeoutMs = 10000; | 35 const int kRequestTimeoutMs = 10000; |
| 36 | 36 |
| 37 COMPILE_ASSERT(kTimerPeriodMs <= kRequestTimeoutMs, | 37 static_assert(kTimerPeriodMs <= kRequestTimeoutMs, |
| 38 timer_period_must_be_less_or_equal_to_request_timeout); | 38 "timer period must be <= request timeout"); |
| 39 | 39 |
| 40 // Combines |data| into a single RefCountedMemory object. | 40 // Combines |data| into a single RefCountedMemory object. |
| 41 scoped_refptr<base::RefCountedMemory> CombineRefCountedMemory( | 41 scoped_refptr<base::RefCountedMemory> CombineRefCountedMemory( |
| 42 const std::vector<scoped_refptr<base::RefCountedMemory> >& data) { | 42 const std::vector<scoped_refptr<base::RefCountedMemory> >& data) { |
| 43 if (data.size() == 1u) | 43 if (data.size() == 1u) |
| 44 return data[0]; | 44 return data[0]; |
| 45 | 45 |
| 46 size_t length = 0; | 46 size_t length = 0; |
| 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(); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 out_type(None), | 312 out_type(None), |
| 313 success(false), | 313 success(false), |
| 314 timeout(timeout), | 314 timeout(timeout), |
| 315 completed(false) { | 315 completed(false) { |
| 316 } | 316 } |
| 317 | 317 |
| 318 SelectionRequestor::Request::~Request() { | 318 SelectionRequestor::Request::~Request() { |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace ui | 321 } // namespace ui |
| OLD | NEW |