| 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_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.h" | 10 #include "ui/base/events.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 public ContextMenuController, | 45 public ContextMenuController, |
| 46 public DragController, | 46 public DragController, |
| 47 public NativeTextfieldWrapper, | 47 public NativeTextfieldWrapper, |
| 48 public ui::TextInputClient, | 48 public ui::TextInputClient, |
| 49 public TextfieldViewsModel::Delegate { | 49 public TextfieldViewsModel::Delegate { |
| 50 public: | 50 public: |
| 51 explicit NativeTextfieldViews(Textfield* parent); | 51 explicit NativeTextfieldViews(Textfield* parent); |
| 52 virtual ~NativeTextfieldViews(); | 52 virtual ~NativeTextfieldViews(); |
| 53 | 53 |
| 54 // View overrides: | 54 // View overrides: |
| 55 virtual gfx::NativeCursor GetCursor(const MouseEvent& event) OVERRIDE; | 55 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; |
| 56 virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; | 56 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 57 virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; | 57 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| 58 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; | 58 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 59 virtual ui::GestureStatus OnGestureEvent(const GestureEvent& event) OVERRIDE; | 59 virtual ui::GestureStatus OnGestureEvent(const GestureEvent& event) OVERRIDE; |
| 60 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 60 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| 61 virtual bool GetDropFormats( | 61 virtual bool GetDropFormats( |
| 62 int* formats, | 62 int* formats, |
| 63 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 63 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
| 64 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; | 64 virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE; |
| 65 virtual int OnDragUpdated(const DropTargetEvent& event) OVERRIDE; | 65 virtual int OnDragUpdated(const DropTargetEvent& event) OVERRIDE; |
| 66 virtual int OnPerformDrop(const DropTargetEvent& event) OVERRIDE; | 66 virtual int OnPerformDrop(const DropTargetEvent& event) OVERRIDE; |
| 67 virtual void OnDragDone() OVERRIDE; | 67 virtual void OnDragDone() OVERRIDE; |
| 68 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; | 68 virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 bool Cut(); | 224 bool Cut(); |
| 225 | 225 |
| 226 // Calls |model_->Copy()| and notifies TextfieldController on success. | 226 // Calls |model_->Copy()| and notifies TextfieldController on success. |
| 227 bool Copy(); | 227 bool Copy(); |
| 228 | 228 |
| 229 // Calls |model_->Paste()| and calls TextfieldController::ContentsChanged() | 229 // Calls |model_->Paste()| and calls TextfieldController::ContentsChanged() |
| 230 // explicitly if paste succeeded. | 230 // explicitly if paste succeeded. |
| 231 bool Paste(); | 231 bool Paste(); |
| 232 | 232 |
| 233 // Tracks the mouse clicks for single/double/triple clicks. | 233 // Tracks the mouse clicks for single/double/triple clicks. |
| 234 void TrackMouseClicks(const MouseEvent& event); | 234 void TrackMouseClicks(const ui::MouseEvent& event); |
| 235 | 235 |
| 236 // Handles mouse press events. | 236 // Handles mouse press events. |
| 237 void HandleMousePressEvent(const MouseEvent& event); | 237 void HandleMousePressEvent(const ui::MouseEvent& event); |
| 238 | 238 |
| 239 // Returns true if the current text input type allows access by the IME. | 239 // Returns true if the current text input type allows access by the IME. |
| 240 bool ImeEditingAllowed() const; | 240 bool ImeEditingAllowed() const; |
| 241 | 241 |
| 242 // Returns true if distance between |event| and |last_click_location_| | 242 // Returns true if distance between |event| and |last_click_location_| |
| 243 // exceeds the drag threshold. | 243 // exceeds the drag threshold. |
| 244 bool ExceededDragThresholdFromLastClickLocation(const MouseEvent& event); | 244 bool ExceededDragThresholdFromLastClickLocation(const ui::MouseEvent& event); |
| 245 | 245 |
| 246 // Checks if a char is ok to be inserted into the textfield. The |ch| is a | 246 // Checks if a char is ok to be inserted into the textfield. The |ch| is a |
| 247 // modified character, i.e., modifiers took effect when generating this char. | 247 // modified character, i.e., modifiers took effect when generating this char. |
| 248 static bool ShouldInsertChar(char16 ch, int flags); | 248 static bool ShouldInsertChar(char16 ch, int flags); |
| 249 | 249 |
| 250 // The parent textfield, the owner of this object. | 250 // The parent textfield, the owner of this object. |
| 251 Textfield* textfield_; | 251 Textfield* textfield_; |
| 252 | 252 |
| 253 // The text model. | 253 // The text model. |
| 254 scoped_ptr<TextfieldViewsModel> model_; | 254 scoped_ptr<TextfieldViewsModel> model_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 281 scoped_ptr<views::MenuRunner> context_menu_runner_; | 281 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 282 | 282 |
| 283 scoped_ptr<TouchSelectionController> touch_selection_controller_; | 283 scoped_ptr<TouchSelectionController> touch_selection_controller_; |
| 284 | 284 |
| 285 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 285 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 } // namespace views | 288 } // namespace views |
| 289 | 289 |
| 290 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 290 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| OLD | NEW |