Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: ui/base/x/selection_requestor.h

Issue 397223002: Enable copying long text to Chrome and pasting long text from Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_REQUESTOR_H_ 5 #ifndef UI_BASE_X_SELECTION_REQUESTOR_H_
6 #define UI_BASE_X_SELECTION_REQUESTOR_H_ 6 #define UI_BASE_X_SELECTION_REQUESTOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 // Returns the first of |types| offered by the current owner of |selection|. 56 // Returns the first of |types| offered by the current owner of |selection|.
57 // Returns an empty SelectionData object if none of |types| are available. 57 // Returns an empty SelectionData object if none of |types| are available.
58 SelectionData RequestAndWaitForTypes(XAtom selection, 58 SelectionData RequestAndWaitForTypes(XAtom selection,
59 const std::vector<XAtom>& types); 59 const std::vector<XAtom>& types);
60 60
61 // It is our owner's responsibility to plumb X11 SelectionNotify events on 61 // It is our owner's responsibility to plumb X11 SelectionNotify events on
62 // |xwindow_| to us. 62 // |xwindow_| to us.
63 void OnSelectionNotify(const XEvent& event); 63 void OnSelectionNotify(const XEvent& event);
64 64
65 // Returns true if SelectionOwner can process the XChangeProperty event,
66 // |event|.
67 bool CanDispatchPropertyEvent(const XEvent& event);
68
69 void OnPropertyEvent(const XEvent& event);
70
65 private: 71 private:
66 friend class SelectionRequestorTest; 72 friend class SelectionRequestorTest;
67 73
68 // A request that has been issued. 74 // A request that has been issued.
69 struct Request { 75 struct Request {
70 Request(XAtom selection, XAtom target, base::TimeTicks timeout); 76 Request(XAtom selection, XAtom target, base::TimeTicks timeout);
71 ~Request(); 77 ~Request();
72 78
73 // The target and selection requested in the XConvertSelection() request. 79 // The target and selection requested in the XConvertSelection() request.
74 // Used for error detection. 80 // Used for error detection.
75 XAtom selection; 81 XAtom selection;
76 XAtom target; 82 XAtom target;
77 83
84 // Whether the result of the XConvertSelection() request is being sent
85 // incrementally.
86 bool data_sent_incrementally;
87
78 // The result data for the XConvertSelection() request. 88 // The result data for the XConvertSelection() request.
79 scoped_refptr<base::RefCountedMemory> out_data; 89 std::vector<scoped_refptr<base::RefCountedMemory> > out_data;
80 size_t out_data_items; 90 size_t out_data_items;
81 XAtom out_type; 91 XAtom out_type;
82 92
83 // Whether the XConvertSelection() request was successful. 93 // Whether the XConvertSelection() request was successful.
84 bool success; 94 bool success;
85 95
86 // The time when the request should be aborted. 96 // The time when the request should be aborted.
87 base::TimeTicks timeout; 97 base::TimeTicks timeout;
88 98
89 // Called to terminate the nested message loop. 99 // Called to terminate the nested message loop.
90 base::Closure quit_closure; 100 base::Closure quit_closure;
91 101
92 // True if the request is complete. 102 // True if the request is complete.
93 bool completed; 103 bool completed;
94 }; 104 };
95 105
96 // Aborts requests which have timed out. 106 // Aborts requests which have timed out.
97 void AbortStaleRequests(); 107 void AbortStaleRequests();
98 108
99 // Mark |request| as completed. If the current request is completed, converts 109 // Mark |request| as completed. If the current request is completed, converts
100 // the selection for the next request. 110 // the selection for the next request.
101 void CompleteRequest(size_t index); 111 void CompleteRequest(size_t index, bool success);
102 112
103 // Converts the selection for the request at |current_request_index_|. 113 // Converts the selection for the request at |current_request_index_|.
104 void ConvertSelectionForCurrentRequest(); 114 void ConvertSelectionForCurrentRequest();
105 115
106 // Blocks till SelectionNotify is received for the target specified in 116 // Blocks till SelectionNotify is received for the target specified in
107 // |request|. 117 // |request|.
108 void BlockTillSelectionNotifyForRequest(Request* request); 118 void BlockTillSelectionNotifyForRequest(Request* request);
109 119
110 // Returns the request at |current_request_index_| or NULL if there isn't any. 120 // Returns the request at |current_request_index_| or NULL if there isn't any.
111 Request* GetCurrentRequest(); 121 Request* GetCurrentRequest();
(...skipping 27 matching lines...) Expand all
139 base::RepeatingTimer<SelectionRequestor> abort_timer_; 149 base::RepeatingTimer<SelectionRequestor> abort_timer_;
140 150
141 X11AtomCache atom_cache_; 151 X11AtomCache atom_cache_;
142 152
143 DISALLOW_COPY_AND_ASSIGN(SelectionRequestor); 153 DISALLOW_COPY_AND_ASSIGN(SelectionRequestor);
144 }; 154 };
145 155
146 } // namespace ui 156 } // namespace ui
147 157
148 #endif // UI_BASE_X_SELECTION_REQUESTOR_H_ 158 #endif // UI_BASE_X_SELECTION_REQUESTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698