| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "ui/base/ime/text_input_client.h" | 11 #include "ui/base/ime/text_input_client.h" |
| 12 #include "ui/base/models/simple_menu_model.h" | 12 #include "ui/base/models/simple_menu_model.h" |
| 13 #include "ui/gfx/font.h" | 13 #include "ui/gfx/font.h" |
| 14 #include "ui/views/border.h" | 14 #include "ui/views/border.h" |
| 15 #include "ui/views/context_menu_controller.h" | 15 #include "ui/views/context_menu_controller.h" |
| 16 #include "ui/views/controls/textfield/native_textfield_wrapper.h" | 16 #include "ui/views/controls/textfield/native_textfield_wrapper.h" |
| 17 #include "ui/views/controls/textfield/textfield_views_model.h" | 17 #include "ui/views/controls/textfield/textfield_views_model.h" |
| 18 #include "ui/views/drag_controller.h" | 18 #include "ui/views/drag_controller.h" |
| 19 #include "ui/views/touchui/touch_selection_controller.h" | 19 #include "ui/views/touchui/touch_selection_controller.h" |
| 20 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class Time; | 23 class Time; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace gfx { | 26 namespace gfx { |
| 27 class Canvas; | 27 class CanvasSkia; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace views { | 30 namespace views { |
| 31 | 31 |
| 32 class FocusableBorder; | 32 class FocusableBorder; |
| 33 class KeyEvent; | 33 class KeyEvent; |
| 34 class MenuModelAdapter; | 34 class MenuModelAdapter; |
| 35 class MenuRunner; | 35 class MenuRunner; |
| 36 | 36 |
| 37 // A views/skia only implementation of NativeTextfieldWrapper. | 37 // A views/skia only implementation of NativeTextfieldWrapper. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; | 59 virtual void OnMouseReleased(const MouseEvent& event) OVERRIDE; |
| 60 virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; | 60 virtual bool OnKeyPressed(const 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 KeyEvent& event) OVERRIDE; | 68 virtual bool OnKeyReleased(const KeyEvent& event) OVERRIDE; |
| 69 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 69 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 70 virtual void OnFocus() OVERRIDE; | 70 virtual void OnFocus() OVERRIDE; |
| 71 virtual void OnBlur() OVERRIDE; | 71 virtual void OnBlur() OVERRIDE; |
| 72 | 72 |
| 73 // TouchSelectionClientView overrides: | 73 // TouchSelectionClientView overrides: |
| 74 virtual void SelectRect(const gfx::Point& start, | 74 virtual void SelectRect(const gfx::Point& start, |
| 75 const gfx::Point& end) OVERRIDE; | 75 const gfx::Point& end) OVERRIDE; |
| 76 | 76 |
| 77 // ContextMenuController overrides: | 77 // ContextMenuController overrides: |
| 78 virtual void ShowContextMenuForView(View* source, | 78 virtual void ShowContextMenuForView(View* source, |
| 79 const gfx::Point& p, | 79 const gfx::Point& p, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 // A callback function to periodically update the cursor state. | 176 // A callback function to periodically update the cursor state. |
| 177 void UpdateCursor(); | 177 void UpdateCursor(); |
| 178 | 178 |
| 179 // Repaint the cursor. | 179 // Repaint the cursor. |
| 180 void RepaintCursor(); | 180 void RepaintCursor(); |
| 181 | 181 |
| 182 // Update the cursor_bounds and text_offset. | 182 // Update the cursor_bounds and text_offset. |
| 183 void UpdateCursorBoundsAndTextOffset(size_t cursor_pos, bool insert_mode); | 183 void UpdateCursorBoundsAndTextOffset(size_t cursor_pos, bool insert_mode); |
| 184 | 184 |
| 185 void PaintTextAndCursor(gfx::Canvas* canvas); | 185 void PaintTextAndCursor(gfx::CanvasSkia* canvas); |
| 186 | 186 |
| 187 // Handle the keyevent. | 187 // Handle the keyevent. |
| 188 bool HandleKeyEvent(const KeyEvent& key_event); | 188 bool HandleKeyEvent(const KeyEvent& key_event); |
| 189 | 189 |
| 190 // Helper function to call MoveCursorTo on the TextfieldViewsModel. | 190 // Helper function to call MoveCursorTo on the TextfieldViewsModel. |
| 191 bool MoveCursorTo(const gfx::Point& point, bool select); | 191 bool MoveCursorTo(const gfx::Point& point, bool select); |
| 192 | 192 |
| 193 // Utility function to inform the parent textfield (and its controller if any) | 193 // Utility function to inform the parent textfield (and its controller if any) |
| 194 // that the text in the textfield has changed. | 194 // that the text in the textfield has changed. |
| 195 void PropagateTextChange(); | 195 void PropagateTextChange(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 scoped_ptr<views::MenuRunner> context_menu_runner_; | 274 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 275 | 275 |
| 276 scoped_ptr<TouchSelectionController> touch_selection_controller_; | 276 scoped_ptr<TouchSelectionController> touch_selection_controller_; |
| 277 | 277 |
| 278 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 278 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 } // namespace views | 281 } // namespace views |
| 282 | 282 |
| 283 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 283 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| OLD | NEW |