| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEWS_MODEL_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 219 |
| 220 // Removes current composition text. | 220 // Removes current composition text. |
| 221 void CancelCompositionText(); | 221 void CancelCompositionText(); |
| 222 | 222 |
| 223 // Retrieves the range of current composition text. | 223 // Retrieves the range of current composition text. |
| 224 void GetCompositionTextRange(gfx::Range* range) const; | 224 void GetCompositionTextRange(gfx::Range* range) const; |
| 225 | 225 |
| 226 // Returns true if there is composition text. | 226 // Returns true if there is composition text. |
| 227 bool HasCompositionText() const; | 227 bool HasCompositionText() const; |
| 228 | 228 |
| 229 // Clears all edit history. |
| 230 void ClearEditHistory(); |
| 231 |
| 229 private: | 232 private: |
| 230 friend class NativeTextfieldViews; | |
| 231 friend class NativeTextfieldViewsTest; | |
| 232 friend class TextfieldViewsModelTest; | 233 friend class TextfieldViewsModelTest; |
| 233 friend class UndoRedo_BasicTest; | 234 friend class UndoRedo_BasicTest; |
| 234 friend class UndoRedo_CutCopyPasteTest; | 235 friend class UndoRedo_CutCopyPasteTest; |
| 235 friend class UndoRedo_ReplaceTest; | 236 friend class UndoRedo_ReplaceTest; |
| 236 friend class internal::Edit; | 237 friend class internal::Edit; |
| 237 | 238 |
| 238 FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_BasicTest); | 239 FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_BasicTest); |
| 239 FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_CutCopyPasteTest); | 240 FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_CutCopyPasteTest); |
| 240 FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_ReplaceTest); | 241 FRIEND_TEST_ALL_PREFIXES(TextfieldViewsModelTest, UndoRedo_ReplaceTest); |
| 241 | 242 |
| 242 // Insert the given |text|. |mergeable| indicates if this insert | 243 // Insert the given |text|. |mergeable| indicates if this insert |
| 243 // operation can be merged to previous edit in the edit history. | 244 // operation can be merged to previous edit in the edit history. |
| 244 void InsertTextInternal(const base::string16& text, bool mergeable); | 245 void InsertTextInternal(const base::string16& text, bool mergeable); |
| 245 | 246 |
| 246 // Replace the current text with the given |text|. |mergeable| | 247 // Replace the current text with the given |text|. |mergeable| |
| 247 // indicates if this replace operation can be merged to previous | 248 // indicates if this replace operation can be merged to previous |
| 248 // edit in the edit history. | 249 // edit in the edit history. |
| 249 void ReplaceTextInternal(const base::string16& text, bool mergeable); | 250 void ReplaceTextInternal(const base::string16& text, bool mergeable); |
| 250 | 251 |
| 251 // Clears all edit history. | |
| 252 void ClearEditHistory(); | |
| 253 | |
| 254 // Clears redo history. | 252 // Clears redo history. |
| 255 void ClearRedoHistory(); | 253 void ClearRedoHistory(); |
| 256 | 254 |
| 257 // Executes and records edit operations. | 255 // Executes and records edit operations. |
| 258 void ExecuteAndRecordDelete(gfx::Range range, bool mergeable); | 256 void ExecuteAndRecordDelete(gfx::Range range, bool mergeable); |
| 259 void ExecuteAndRecordReplaceSelection(internal::MergeType merge_type, | 257 void ExecuteAndRecordReplaceSelection(internal::MergeType merge_type, |
| 260 const base::string16& text); | 258 const base::string16& text); |
| 261 void ExecuteAndRecordReplace(internal::MergeType merge_type, | 259 void ExecuteAndRecordReplace(internal::MergeType merge_type, |
| 262 size_t old_cursor_pos, | 260 size_t old_cursor_pos, |
| 263 size_t new_cursor_pos, | 261 size_t new_cursor_pos, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // 2) new edit is added. (redo history is cleared) | 302 // 2) new edit is added. (redo history is cleared) |
| 305 // 3) redone all undone edits. | 303 // 3) redone all undone edits. |
| 306 EditHistory::iterator current_edit_; | 304 EditHistory::iterator current_edit_; |
| 307 | 305 |
| 308 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); | 306 DISALLOW_COPY_AND_ASSIGN(TextfieldViewsModel); |
| 309 }; | 307 }; |
| 310 | 308 |
| 311 } // namespace views | 309 } // namespace views |
| 312 | 310 |
| 313 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ | 311 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_VIEWS_MODEL_H_ |
| OLD | NEW |