| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 // A callback function to periodically update the cursor state. | 301 // A callback function to periodically update the cursor state. |
| 302 void UpdateCursor(); | 302 void UpdateCursor(); |
| 303 | 303 |
| 304 // Repaint the cursor. | 304 // Repaint the cursor. |
| 305 void RepaintCursor(); | 305 void RepaintCursor(); |
| 306 | 306 |
| 307 void PaintTextAndCursor(gfx::Canvas* canvas); | 307 void PaintTextAndCursor(gfx::Canvas* canvas); |
| 308 | 308 |
| 309 // Helper function to call MoveCursorTo on the TextfieldModel. | 309 // Helper function to call MoveCursorTo on the TextfieldModel. |
| 310 bool MoveCursorTo(const gfx::Point& point, bool select); | 310 void MoveCursorTo(const gfx::Point& point, bool select); |
| 311 | 311 |
| 312 // Convenience method to call InputMethod::OnCaretBoundsChanged(); | 312 // Convenience method to notify the InputMethod and TouchSelectionController. |
| 313 void OnCaretBoundsChanged(); | 313 void OnCaretBoundsChanged(); |
| 314 | 314 |
| 315 // Convenience method to call TextfieldController::OnBeforeUserAction(); | 315 // Convenience method to call TextfieldController::OnBeforeUserAction(); |
| 316 void OnBeforeUserAction(); | 316 void OnBeforeUserAction(); |
| 317 | 317 |
| 318 // Convenience method to call TextfieldController::OnAfterUserAction(); | 318 // Convenience method to call TextfieldController::OnAfterUserAction(); |
| 319 void OnAfterUserAction(); | 319 void OnAfterUserAction(); |
| 320 | 320 |
| 321 // Calls |model_->Cut()| and notifies TextfieldController on success. | 321 // Calls |model_->Cut()| and notifies TextfieldController on success. |
| 322 bool Cut(); | 322 bool Cut(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 336 | 336 |
| 337 // Returns true if the current text input type allows access by the IME. | 337 // Returns true if the current text input type allows access by the IME. |
| 338 bool ImeEditingAllowed() const; | 338 bool ImeEditingAllowed() const; |
| 339 | 339 |
| 340 // Reveals the password character at |index| for a set duration. | 340 // Reveals the password character at |index| for a set duration. |
| 341 // If |index| is -1, the existing revealed character will be reset. | 341 // If |index| is -1, the existing revealed character will be reset. |
| 342 void RevealPasswordChar(int index); | 342 void RevealPasswordChar(int index); |
| 343 | 343 |
| 344 void CreateTouchSelectionControllerAndNotifyIt(); | 344 void CreateTouchSelectionControllerAndNotifyIt(); |
| 345 | 345 |
| 346 // Updates the selection clipboard to any non-empty text selection. |
| 347 void UpdateSelectionClipboard() const; |
| 348 |
| 349 // Pastes the selection clipboard for the specified mouse event. |
| 350 void PasteSelectionClipboard(const ui::MouseEvent& event); |
| 351 |
| 346 // The text model. | 352 // The text model. |
| 347 scoped_ptr<TextfieldModel> model_; | 353 scoped_ptr<TextfieldModel> model_; |
| 348 | 354 |
| 349 // This is the current listener for events from this Textfield. | 355 // This is the current listener for events from this Textfield. |
| 350 TextfieldController* controller_; | 356 TextfieldController* controller_; |
| 351 | 357 |
| 352 // True if this Textfield cannot accept input and is read-only. | 358 // True if this Textfield cannot accept input and is read-only. |
| 353 bool read_only_; | 359 bool read_only_; |
| 354 | 360 |
| 355 // The default number of average characters for the width of this text field. | 361 // The default number of average characters for the width of this text field. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 375 | 381 |
| 376 // Placeholder text color. | 382 // Placeholder text color. |
| 377 SkColor placeholder_text_color_; | 383 SkColor placeholder_text_color_; |
| 378 | 384 |
| 379 // The accessible name of the text field. | 385 // The accessible name of the text field. |
| 380 base::string16 accessible_name_; | 386 base::string16 accessible_name_; |
| 381 | 387 |
| 382 // The input type of this text field. | 388 // The input type of this text field. |
| 383 ui::TextInputType text_input_type_; | 389 ui::TextInputType text_input_type_; |
| 384 | 390 |
| 385 // The duration to reveal the last typed char for password textfields. | 391 // The duration and timer to reveal the last typed password character. |
| 386 base::TimeDelta password_reveal_duration_; | 392 base::TimeDelta password_reveal_duration_; |
| 393 base::OneShotTimer<Textfield> password_reveal_timer_; |
| 387 | 394 |
| 388 // True if InputMethod::CancelComposition() should not be called. | 395 // True if InputMethod::CancelComposition() should not be called. |
| 389 bool skip_input_method_cancel_composition_; | 396 bool skip_input_method_cancel_composition_; |
| 390 | 397 |
| 391 // The text editing cursor repaint timer and visibility. | 398 // The text editing cursor repaint timer and visibility. |
| 392 base::RepeatingTimer<Textfield> cursor_repaint_timer_; | 399 base::RepeatingTimer<Textfield> cursor_repaint_timer_; |
| 393 bool cursor_visible_; | 400 bool cursor_visible_; |
| 394 | 401 |
| 395 // The drop cursor is a visual cue for where dragged text will be dropped. | 402 // The drop cursor is a visual cue for where dragged text will be dropped. |
| 396 bool drop_cursor_visible_; | 403 bool drop_cursor_visible_; |
| 397 gfx::SelectionModel drop_cursor_position_; | 404 gfx::SelectionModel drop_cursor_position_; |
| 398 | 405 |
| 399 // Is the user potentially dragging and dropping from this view? | 406 // Is the user potentially dragging and dropping from this view? |
| 400 bool initiating_drag_; | 407 bool initiating_drag_; |
| 401 | 408 |
| 402 // State variables used to track double and triple clicks. | 409 // State variables used to track double and triple clicks. |
| 403 size_t aggregated_clicks_; | 410 size_t aggregated_clicks_; |
| 404 base::TimeDelta last_click_time_; | 411 base::TimeDelta last_click_time_; |
| 405 gfx::Point last_click_location_; | 412 gfx::Point last_click_location_; |
| 406 gfx::Range double_click_word_; | 413 gfx::Range double_click_word_; |
| 407 | 414 |
| 408 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; | 415 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; |
| 409 | 416 |
| 410 // A timer to control the duration of showing the last typed char in | |
| 411 // password text. When the timer is running, the last typed char is shown | |
| 412 // and when the time expires, the last typed char is password. | |
| 413 base::OneShotTimer<Textfield> password_reveal_timer_; | |
| 414 | |
| 415 // Context menu related members. | 417 // Context menu related members. |
| 416 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; | 418 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; |
| 417 scoped_ptr<views::MenuRunner> context_menu_runner_; | 419 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 418 | 420 |
| 419 // Used to bind callback functions to this object. | 421 // Used to bind callback functions to this object. |
| 420 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 422 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 421 | 423 |
| 422 DISALLOW_COPY_AND_ASSIGN(Textfield); | 424 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 423 }; | 425 }; |
| 424 | 426 |
| 425 } // namespace views | 427 } // namespace views |
| 426 | 428 |
| 427 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 429 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |