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_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 void RevealPasswordChar(int index); | 385 void RevealPasswordChar(int index); |
386 | 386 |
387 void CreateTouchSelectionControllerAndNotifyIt(); | 387 void CreateTouchSelectionControllerAndNotifyIt(); |
388 | 388 |
389 // Updates the selection clipboard to any non-empty text selection. | 389 // Updates the selection clipboard to any non-empty text selection. |
390 void UpdateSelectionClipboard() const; | 390 void UpdateSelectionClipboard() const; |
391 | 391 |
392 // Pastes the selection clipboard for the specified mouse event. | 392 // Pastes the selection clipboard for the specified mouse event. |
393 void PasteSelectionClipboard(const ui::MouseEvent& event); | 393 void PasteSelectionClipboard(const ui::MouseEvent& event); |
394 | 394 |
395 // Returns true if an insertion cursor should be visible (a vertical bar, | |
396 // placed at the point new text will be inserted). | |
397 bool ShouldShowCursor() const; | |
398 | |
399 // Returns true if an insertion cursor should be visible and blinking. | |
400 bool ShouldBlinkCursor() const; | |
401 | |
402 // Starts and stops blinking the cursor, respectively. These are both | |
403 // idempotent if the cursor is already blinking/not blinking. | |
404 void StartBlinkingCursor(); | |
405 void StopBlinkingCursor(); | |
406 | |
407 // Callback for the cursor blink timer. Called every | |
408 // |Textfield::GetCaretBlinkMs()|. | |
Peter Kasting
2016/09/20 17:15:41
Nit: No || on function names
Elly Fong-Jones
2016/09/21 14:00:10
Done.
| |
409 void BlinkCursor(); | |
Peter Kasting
2016/09/20 17:15:41
Nit: OnCursorBlinkTimerFired()?
Elly Fong-Jones
2016/09/21 14:00:10
Done.
| |
410 | |
395 // The text model. | 411 // The text model. |
396 std::unique_ptr<TextfieldModel> model_; | 412 std::unique_ptr<TextfieldModel> model_; |
397 | 413 |
398 // This is the current listener for events from this Textfield. | 414 // This is the current listener for events from this Textfield. |
399 TextfieldController* controller_; | 415 TextfieldController* controller_; |
400 | 416 |
401 // An edit command to execute on the next key event. When set to a valid | 417 // An edit command to execute on the next key event. When set to a valid |
402 // value, the key event is still passed to |controller_|, but otherwise | 418 // value, the key event is still passed to |controller_|, but otherwise |
403 // ignored in favor of the edit command. Set via | 419 // ignored in favor of the edit command. Set via |
404 // SetTextEditCommandForNextKeyEvent() during dispatch of that key event (see | 420 // SetTextEditCommandForNextKeyEvent() during dispatch of that key event (see |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 // The timer to reveal the last typed password character. | 458 // The timer to reveal the last typed password character. |
443 base::OneShotTimer password_reveal_timer_; | 459 base::OneShotTimer password_reveal_timer_; |
444 | 460 |
445 // Tracks whether a user action is being performed; i.e. OnBeforeUserAction() | 461 // Tracks whether a user action is being performed; i.e. OnBeforeUserAction() |
446 // has been called, but OnAfterUserAction() has not yet been called. | 462 // has been called, but OnAfterUserAction() has not yet been called. |
447 bool performing_user_action_; | 463 bool performing_user_action_; |
448 | 464 |
449 // True if InputMethod::CancelComposition() should not be called. | 465 // True if InputMethod::CancelComposition() should not be called. |
450 bool skip_input_method_cancel_composition_; | 466 bool skip_input_method_cancel_composition_; |
451 | 467 |
452 // The text editing cursor repaint timer and visibility. | 468 // Insertion cursor repaint timer and visibility. |
453 base::RepeatingTimer cursor_repaint_timer_; | 469 base::RepeatingTimer cursor_blink_timer_; |
454 bool cursor_visible_; | |
455 | 470 |
456 // The drop cursor is a visual cue for where dragged text will be dropped. | 471 // The drop cursor is a visual cue for where dragged text will be dropped. |
457 bool drop_cursor_visible_; | 472 bool drop_cursor_visible_; |
458 gfx::SelectionModel drop_cursor_position_; | 473 gfx::SelectionModel drop_cursor_position_; |
459 | 474 |
460 // Is the user potentially dragging and dropping from this view? | 475 // Is the user potentially dragging and dropping from this view? |
461 bool initiating_drag_; | 476 bool initiating_drag_; |
462 | 477 |
463 // A timer and point used to modify the selection when dragging. | 478 // A timer and point used to modify the selection when dragging. |
464 base::RepeatingTimer drag_selection_timer_; | 479 base::RepeatingTimer drag_selection_timer_; |
(...skipping 23 matching lines...) Expand all Loading... | |
488 | 503 |
489 // Used to bind callback functions to this object. | 504 // Used to bind callback functions to this object. |
490 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 505 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
491 | 506 |
492 DISALLOW_COPY_AND_ASSIGN(Textfield); | 507 DISALLOW_COPY_AND_ASSIGN(Textfield); |
493 }; | 508 }; |
494 | 509 |
495 } // namespace views | 510 } // namespace views |
496 | 511 |
497 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 512 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |