| 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 #ifndef UI_BASE_X_SELECTION_OWNER_H_ | 5 #ifndef UI_BASE_X_SELECTION_OWNER_H_ |
| 6 #define UI_BASE_X_SELECTION_OWNER_H_ | 6 #define UI_BASE_X_SELECTION_OWNER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void OnPropertyEvent(const XEvent& event); | 58 void OnPropertyEvent(const XEvent& event); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // Holds state related to an incremental data transfer. | 61 // Holds state related to an incremental data transfer. |
| 62 struct IncrementalTransfer { | 62 struct IncrementalTransfer { |
| 63 IncrementalTransfer(XID window, | 63 IncrementalTransfer(XID window, |
| 64 XAtom target, | 64 XAtom target, |
| 65 XAtom property, | 65 XAtom property, |
| 66 const scoped_refptr<base::RefCountedMemory>& data, | 66 const scoped_refptr<base::RefCountedMemory>& data, |
| 67 int offset, | 67 int offset, |
| 68 base::TimeTicks timeout, | 68 base::TimeTicks timeout); |
| 69 int foreign_window_manager_id); | |
| 70 IncrementalTransfer(const IncrementalTransfer& other); | 69 IncrementalTransfer(const IncrementalTransfer& other); |
| 71 ~IncrementalTransfer(); | 70 ~IncrementalTransfer(); |
| 72 | 71 |
| 73 // Parameters from the XSelectionRequest. The data is transferred over | 72 // Parameters from the XSelectionRequest. The data is transferred over |
| 74 // |property| on |window|. | 73 // |property| on |window|. |
| 75 XID window; | 74 XID window; |
| 76 XAtom target; | 75 XAtom target; |
| 77 XAtom property; | 76 XAtom property; |
| 78 | 77 |
| 79 // The data to be transferred. | 78 // The data to be transferred. |
| 80 scoped_refptr<base::RefCountedMemory> data; | 79 scoped_refptr<base::RefCountedMemory> data; |
| 81 | 80 |
| 82 // The offset from the beginning of |data| of the first byte to be | 81 // The offset from the beginning of |data| of the first byte to be |
| 83 // transferred in the next chunk. | 82 // transferred in the next chunk. |
| 84 size_t offset; | 83 size_t offset; |
| 85 | 84 |
| 86 // Time when the transfer should be aborted because the selection requestor | 85 // Time when the transfer should be aborted because the selection requestor |
| 87 // is taking too long to notify us that we can send the next chunk. | 86 // is taking too long to notify us that we can send the next chunk. |
| 88 base::TimeTicks timeout; | 87 base::TimeTicks timeout; |
| 89 | |
| 90 // Used to unselect PropertyChangeMask on |window| when we are done with | |
| 91 // the data transfer. | |
| 92 int foreign_window_manager_id; | |
| 93 }; | 88 }; |
| 94 | 89 |
| 95 // Attempts to convert the selection to |target|. If the conversion is | 90 // Attempts to convert the selection to |target|. If the conversion is |
| 96 // successful, true is returned and the result is stored in the |property| | 91 // successful, true is returned and the result is stored in the |property| |
| 97 // of |requestor|. | 92 // of |requestor|. |
| 98 bool ProcessTarget(XAtom target, XID requestor, XAtom property); | 93 bool ProcessTarget(XAtom target, XID requestor, XAtom property); |
| 99 | 94 |
| 100 // Sends the next chunk of data for given the incremental data transfer. | 95 // Sends the next chunk of data for given the incremental data transfer. |
| 101 void ProcessIncrementalTransfer(IncrementalTransfer* transfer); | 96 void ProcessIncrementalTransfer(IncrementalTransfer* transfer); |
| 102 | 97 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 base::RepeatingTimer incremental_transfer_abort_timer_; | 129 base::RepeatingTimer incremental_transfer_abort_timer_; |
| 135 | 130 |
| 136 X11AtomCache atom_cache_; | 131 X11AtomCache atom_cache_; |
| 137 | 132 |
| 138 DISALLOW_COPY_AND_ASSIGN(SelectionOwner); | 133 DISALLOW_COPY_AND_ASSIGN(SelectionOwner); |
| 139 }; | 134 }; |
| 140 | 135 |
| 141 } // namespace ui | 136 } // namespace ui |
| 142 | 137 |
| 143 #endif // UI_BASE_X_SELECTION_OWNER_H_ | 138 #endif // UI_BASE_X_SELECTION_OWNER_H_ |
| OLD | NEW |