| 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 20 matching lines...) Expand all Loading... |
| 31 #include "ui/views/drag_controller.h" | 31 #include "ui/views/drag_controller.h" |
| 32 #include "ui/views/selection_controller.h" | 32 #include "ui/views/selection_controller.h" |
| 33 #include "ui/views/selection_controller_delegate.h" | 33 #include "ui/views/selection_controller_delegate.h" |
| 34 #include "ui/views/view.h" | 34 #include "ui/views/view.h" |
| 35 #include "ui/views/word_lookup_client.h" | 35 #include "ui/views/word_lookup_client.h" |
| 36 | 36 |
| 37 namespace views { | 37 namespace views { |
| 38 | 38 |
| 39 class MenuRunner; | 39 class MenuRunner; |
| 40 class TextfieldController; | 40 class TextfieldController; |
| 41 class ViewsTextServicesContextMenu; |
| 41 | 42 |
| 42 // A views/skia textfield implementation. No platform-specific code is used. | 43 // A views/skia textfield implementation. No platform-specific code is used. |
| 43 class VIEWS_EXPORT Textfield : public View, | 44 class VIEWS_EXPORT Textfield : public View, |
| 44 public TextfieldModel::Delegate, | 45 public TextfieldModel::Delegate, |
| 45 public ContextMenuController, | 46 public ContextMenuController, |
| 46 public DragController, | 47 public DragController, |
| 47 public WordLookupClient, | 48 public WordLookupClient, |
| 48 public SelectionControllerDelegate, | 49 public SelectionControllerDelegate, |
| 49 public ui::TouchEditable, | 50 public ui::TouchEditable, |
| 50 public ui::TextInputClient { | 51 public ui::TextInputClient { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // DragController overrides: | 258 // DragController overrides: |
| 258 void WriteDragDataForView(View* sender, | 259 void WriteDragDataForView(View* sender, |
| 259 const gfx::Point& press_pt, | 260 const gfx::Point& press_pt, |
| 260 ui::OSExchangeData* data) override; | 261 ui::OSExchangeData* data) override; |
| 261 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; | 262 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; |
| 262 bool CanStartDragForView(View* sender, | 263 bool CanStartDragForView(View* sender, |
| 263 const gfx::Point& press_pt, | 264 const gfx::Point& press_pt, |
| 264 const gfx::Point& p) override; | 265 const gfx::Point& p) override; |
| 265 | 266 |
| 266 // WordLookupClient overrides: | 267 // WordLookupClient overrides: |
| 267 bool GetDecoratedWordAtPoint(const gfx::Point& point, | 268 bool GetDecoratedWordAndBaselineAtPoint(const gfx::Point& point, |
| 268 gfx::DecoratedText* decorated_word, | 269 gfx::DecoratedText* decorated_word, |
| 269 gfx::Point* baseline_point) override; | 270 gfx::Point* baseline_point) override; |
| 271 bool GetDecoratedTextAndBaselineFromSelection( |
| 272 gfx::DecoratedText* decorated_text, |
| 273 gfx::Point* baseline_point) override; |
| 270 | 274 |
| 271 // SelectionControllerDelegate overrides: | 275 // SelectionControllerDelegate overrides: |
| 272 bool HasTextBeingDragged() const override; | 276 bool HasTextBeingDragged() const override; |
| 273 | 277 |
| 274 // ui::TouchEditable overrides: | 278 // ui::TouchEditable overrides: |
| 275 void SelectRect(const gfx::Point& start, const gfx::Point& end) override; | 279 void SelectRect(const gfx::Point& start, const gfx::Point& end) override; |
| 276 void MoveCaretTo(const gfx::Point& point) override; | 280 void MoveCaretTo(const gfx::Point& point) override; |
| 277 void GetSelectionEndPoints(gfx::SelectionBound* anchor, | 281 void GetSelectionEndPoints(gfx::SelectionBound* anchor, |
| 278 gfx::SelectionBound* focus) override; | 282 gfx::SelectionBound* focus) override; |
| 279 gfx::Rect GetBounds() override; | 283 gfx::Rect GetBounds() override; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 519 |
| 516 // Tracks if touch editing handles are hidden because user has started | 520 // Tracks if touch editing handles are hidden because user has started |
| 517 // scrolling. If |true|, handles are shown after scrolling ends. | 521 // scrolling. If |true|, handles are shown after scrolling ends. |
| 518 bool touch_handles_hidden_due_to_scroll_; | 522 bool touch_handles_hidden_due_to_scroll_; |
| 519 | 523 |
| 520 // True if this textfield should use a focus ring to indicate focus. | 524 // True if this textfield should use a focus ring to indicate focus. |
| 521 bool use_focus_ring_; | 525 bool use_focus_ring_; |
| 522 | 526 |
| 523 // Context menu related members. | 527 // Context menu related members. |
| 524 std::unique_ptr<ui::SimpleMenuModel> context_menu_contents_; | 528 std::unique_ptr<ui::SimpleMenuModel> context_menu_contents_; |
| 529 std::unique_ptr<ViewsTextServicesContextMenu> text_services_context_menu_; |
| 525 std::unique_ptr<views::MenuRunner> context_menu_runner_; | 530 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
| 526 | 531 |
| 527 // Used to bind callback functions to this object. | 532 // Used to bind callback functions to this object. |
| 528 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 533 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 529 | 534 |
| 530 DISALLOW_COPY_AND_ASSIGN(Textfield); | 535 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 531 }; | 536 }; |
| 532 | 537 |
| 533 } // namespace views | 538 } // namespace views |
| 534 | 539 |
| 535 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 540 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |