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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // DragController overrides: | 261 // DragController overrides: |
261 void WriteDragDataForView(View* sender, | 262 void WriteDragDataForView(View* sender, |
262 const gfx::Point& press_pt, | 263 const gfx::Point& press_pt, |
263 ui::OSExchangeData* data) override; | 264 ui::OSExchangeData* data) override; |
264 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; | 265 int GetDragOperationsForView(View* sender, const gfx::Point& p) override; |
265 bool CanStartDragForView(View* sender, | 266 bool CanStartDragForView(View* sender, |
266 const gfx::Point& press_pt, | 267 const gfx::Point& press_pt, |
267 const gfx::Point& p) override; | 268 const gfx::Point& p) override; |
268 | 269 |
269 // WordLookupClient overrides: | 270 // WordLookupClient overrides: |
270 bool GetDecoratedWordAtPoint(const gfx::Point& point, | 271 bool GetDecoratedWordAndBaselineAtPoint(const gfx::Point& point, |
271 gfx::DecoratedText* decorated_word, | 272 gfx::DecoratedText* decorated_word, |
272 gfx::Point* baseline_point) override; | 273 gfx::Point* baseline_point) override; |
| 274 bool GetDecoratedTextAndBaselineFromSelection( |
| 275 gfx::DecoratedText* decorated_text, |
| 276 gfx::Point* baseline_point) override; |
273 | 277 |
274 // SelectionControllerDelegate overrides: | 278 // SelectionControllerDelegate overrides: |
275 bool HasTextBeingDragged() const override; | 279 bool HasTextBeingDragged() const override; |
276 | 280 |
277 // ui::TouchEditable overrides: | 281 // ui::TouchEditable overrides: |
278 void SelectRect(const gfx::Point& start, const gfx::Point& end) override; | 282 void SelectRect(const gfx::Point& start, const gfx::Point& end) override; |
279 void MoveCaretTo(const gfx::Point& point) override; | 283 void MoveCaretTo(const gfx::Point& point) override; |
280 void GetSelectionEndPoints(gfx::SelectionBound* anchor, | 284 void GetSelectionEndPoints(gfx::SelectionBound* anchor, |
281 gfx::SelectionBound* focus) override; | 285 gfx::SelectionBound* focus) override; |
282 gfx::Rect GetBounds() override; | 286 gfx::Rect GetBounds() override; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 522 |
519 // Tracks if touch editing handles are hidden because user has started | 523 // Tracks if touch editing handles are hidden because user has started |
520 // scrolling. If |true|, handles are shown after scrolling ends. | 524 // scrolling. If |true|, handles are shown after scrolling ends. |
521 bool touch_handles_hidden_due_to_scroll_; | 525 bool touch_handles_hidden_due_to_scroll_; |
522 | 526 |
523 // True if this textfield should use a focus ring to indicate focus. | 527 // True if this textfield should use a focus ring to indicate focus. |
524 bool use_focus_ring_; | 528 bool use_focus_ring_; |
525 | 529 |
526 // Context menu related members. | 530 // Context menu related members. |
527 std::unique_ptr<ui::SimpleMenuModel> context_menu_contents_; | 531 std::unique_ptr<ui::SimpleMenuModel> context_menu_contents_; |
| 532 std::unique_ptr<ViewsTextServicesContextMenu> text_services_context_menu_; |
528 std::unique_ptr<views::MenuRunner> context_menu_runner_; | 533 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
529 | 534 |
530 // Used to bind callback functions to this object. | 535 // Used to bind callback functions to this object. |
531 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 536 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
532 | 537 |
533 DISALLOW_COPY_AND_ASSIGN(Textfield); | 538 DISALLOW_COPY_AND_ASSIGN(Textfield); |
534 }; | 539 }; |
535 | 540 |
536 } // namespace views | 541 } // namespace views |
537 | 542 |
538 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 543 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |