Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: ui/views/controls/textfield/native_textfield_views.h

Issue 14264004: Re-land: NativeTextfieldViews: Show the drop cursor when dragging text (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 4 Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_NATIVE_TEXTFIELD_VIEWS_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "ui/base/events/event_constants.h" 10 #include "ui/base/events/event_constants.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; 62 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
63 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; 63 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
64 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; 64 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
65 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 65 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
66 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 66 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
67 virtual bool GetDropFormats( 67 virtual bool GetDropFormats(
68 int* formats, 68 int* formats,
69 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; 69 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE;
70 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; 70 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE;
71 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; 71 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE;
72 virtual void OnDragExited() OVERRIDE;
72 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; 73 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE;
73 virtual void OnDragDone() OVERRIDE; 74 virtual void OnDragDone() OVERRIDE;
74 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; 75 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE;
75 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 76 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
76 virtual void OnFocus() OVERRIDE; 77 virtual void OnFocus() OVERRIDE;
77 virtual void OnBlur() OVERRIDE; 78 virtual void OnBlur() OVERRIDE;
78 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; 79 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
79 80
80 // ui::TouchEditable overrides: 81 // ui::TouchEditable overrides:
81 virtual void SelectRect(const gfx::Point& start, 82 virtual void SelectRect(const gfx::Point& start,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 Textfield* textfield_; 287 Textfield* textfield_;
287 288
288 // The text model. 289 // The text model.
289 scoped_ptr<TextfieldViewsModel> model_; 290 scoped_ptr<TextfieldViewsModel> model_;
290 291
291 // The reference to the border class. The object is owned by View::border_. 292 // The reference to the border class. The object is owned by View::border_.
292 FocusableBorder* text_border_; 293 FocusableBorder* text_border_;
293 294
294 // The textfield's text and drop cursor visibility. 295 // The textfield's text and drop cursor visibility.
295 bool is_cursor_visible_; 296 bool is_cursor_visible_;
297
296 // The drop cursor is a visual cue for where dragged text will be dropped. 298 // The drop cursor is a visual cue for where dragged text will be dropped.
297 bool is_drop_cursor_visible_; 299 bool is_drop_cursor_visible_;
300 // Position of the drop cursor, if it is visible.
301 gfx::SelectionModel drop_cursor_position_;
298 302
299 // True if InputMethod::CancelComposition() should not be called. 303 // True if InputMethod::CancelComposition() should not be called.
300 bool skip_input_method_cancel_composition_; 304 bool skip_input_method_cancel_composition_;
301 305
302 // Is the user potentially dragging and dropping from this view? 306 // Is the user potentially dragging and dropping from this view?
303 bool initiating_drag_; 307 bool initiating_drag_;
304 308
305 // A runnable method factory for callback to update the cursor. 309 // A runnable method factory for callback to update the cursor.
306 base::WeakPtrFactory<NativeTextfieldViews> cursor_timer_; 310 base::WeakPtrFactory<NativeTextfieldViews> cursor_timer_;
307 311
308 // State variables used to track double and triple clicks. 312 // State variables used to track double and triple clicks.
309 size_t aggregated_clicks_; 313 size_t aggregated_clicks_;
310 base::TimeDelta last_click_time_; 314 base::TimeDelta last_click_time_;
311 gfx::Point last_click_location_; 315 gfx::Point last_click_location_;
312 316
313 // Context menu and its content list for the textfield. 317 // Context menu and its content list for the textfield.
314 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_; 318 scoped_ptr<ui::SimpleMenuModel> context_menu_contents_;
315 scoped_ptr<views::MenuModelAdapter> context_menu_delegate_; 319 scoped_ptr<views::MenuModelAdapter> context_menu_delegate_;
316 scoped_ptr<views::MenuRunner> context_menu_runner_; 320 scoped_ptr<views::MenuRunner> context_menu_runner_;
317 321
318 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_; 322 scoped_ptr<ui::TouchSelectionController> touch_selection_controller_;
319 323
320 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); 324 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews);
321 }; 325 };
322 326
323 } // namespace views 327 } // namespace views
324 328
325 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ 329 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698