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

Side by Side Diff: ui/views/controls/textfield/textfield_model.h

Issue 2408623002: Views: Extract text selection code from Textfield. (Closed)
Patch Set: Check for |handles_selection_clipboard_| Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Moves the cursor, see RenderText for additional details. 119 // Moves the cursor, see RenderText for additional details.
120 // The current composition text will be confirmed. 120 // The current composition text will be confirmed.
121 void MoveCursor(gfx::BreakType break_type, 121 void MoveCursor(gfx::BreakType break_type,
122 gfx::VisualCursorDirection direction, 122 gfx::VisualCursorDirection direction,
123 gfx::SelectionBehavior selection_behavior); 123 gfx::SelectionBehavior selection_behavior);
124 124
125 // Updates the cursor to the specified selection model. Any composition text 125 // Updates the cursor to the specified selection model. Any composition text
126 // will be confirmed, which may alter the specified selection range start. 126 // will be confirmed, which may alter the specified selection range start.
127 bool MoveCursorTo(const gfx::SelectionModel& cursor); 127 bool MoveCursorTo(const gfx::SelectionModel& cursor);
128 128
129 // Helper function to call MoveCursorTo on the TextfieldModel. 129 // Calls the corresponding function on the associated RenderText instance. Any
130 // composition text will be confirmed.
130 bool MoveCursorTo(const gfx::Point& point, bool select); 131 bool MoveCursorTo(const gfx::Point& point, bool select);
131 132
132 // Selection related methods. 133 // Selection related methods.
133 134
134 // Returns the selected text. 135 // Returns the selected text.
135 base::string16 GetSelectedText() const; 136 base::string16 GetSelectedText() const;
136 137
137 // The current composition text will be confirmed. The selection starts with 138 // The current composition text will be confirmed. The selection starts with
138 // the range's start position, and ends with the range's end position, 139 // the range's start position, and ends with the range's end position,
139 // therefore the cursor position becomes the end position. 140 // therefore the cursor position becomes the end position.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // 2) new edit is added. (redo history is cleared) 311 // 2) new edit is added. (redo history is cleared)
311 // 3) redone all undone edits. 312 // 3) redone all undone edits.
312 EditHistory::iterator current_edit_; 313 EditHistory::iterator current_edit_;
313 314
314 DISALLOW_COPY_AND_ASSIGN(TextfieldModel); 315 DISALLOW_COPY_AND_ASSIGN(TextfieldModel);
315 }; 316 };
316 317
317 } // namespace views 318 } // namespace views
318 319
319 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_ 320 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698