Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "testing/gtest/include/gtest/gtest_prod.h" | |
|
sky
2014/05/21 16:20:45
Why do you need this include?
mohsen
2014/05/21 19:54:28
Not needed. Residue of some tests, sorry! Removed.
| |
| 16 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
| 17 #include "ui/base/ime/text_input_client.h" | 18 #include "ui/base/ime/text_input_client.h" |
| 18 #include "ui/base/ime/text_input_type.h" | 19 #include "ui/base/ime/text_input_type.h" |
| 19 #include "ui/base/models/simple_menu_model.h" | 20 #include "ui/base/models/simple_menu_model.h" |
| 20 #include "ui/base/touch/touch_editing_controller.h" | 21 #include "ui/base/touch/touch_editing_controller.h" |
| 21 #include "ui/events/keycodes/keyboard_codes.h" | 22 #include "ui/events/keycodes/keyboard_codes.h" |
| 22 #include "ui/gfx/font_list.h" | 23 #include "ui/gfx/font_list.h" |
| 23 #include "ui/gfx/range/range.h" | 24 #include "ui/gfx/range/range.h" |
| 24 #include "ui/gfx/selection_model.h" | 25 #include "ui/gfx/selection_model.h" |
| 25 #include "ui/gfx/text_constants.h" | 26 #include "ui/gfx/text_constants.h" |
| 26 #include "ui/views/context_menu_controller.h" | 27 #include "ui/views/context_menu_controller.h" |
| 27 #include "ui/views/controls/textfield/textfield_model.h" | 28 #include "ui/views/controls/textfield/textfield_model.h" |
| 28 #include "ui/views/drag_controller.h" | 29 #include "ui/views/drag_controller.h" |
| 29 #include "ui/views/view.h" | 30 #include "ui/views/view.h" |
| 30 | 31 |
| 31 namespace views { | 32 namespace views { |
| 32 | 33 |
| 33 namespace test { | |
| 34 class WidgetTestInteractive; | |
| 35 } | |
| 36 | |
| 37 class MenuRunner; | 34 class MenuRunner; |
| 38 class Painter; | 35 class Painter; |
| 39 class TextfieldController; | 36 class TextfieldController; |
| 40 | 37 |
| 41 // A views/skia textfield implementation. No platform-specific code is used. | 38 // A views/skia textfield implementation. No platform-specific code is used. |
| 42 class VIEWS_EXPORT Textfield : public View, | 39 class VIEWS_EXPORT Textfield : public View, |
| 43 public TextfieldModel::Delegate, | 40 public TextfieldModel::Delegate, |
| 44 public ContextMenuController, | 41 public ContextMenuController, |
| 45 public DragController, | 42 public DragController, |
| 46 public ui::TouchEditable, | 43 public ui::TouchEditable, |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 protected: | 287 protected: |
| 291 // Returns the TextfieldModel's text/cursor/selection rendering model. | 288 // Returns the TextfieldModel's text/cursor/selection rendering model. |
| 292 gfx::RenderText* GetRenderText() const; | 289 gfx::RenderText* GetRenderText() const; |
| 293 | 290 |
| 294 gfx::Point last_click_location() const { return last_click_location_; } | 291 gfx::Point last_click_location() const { return last_click_location_; } |
| 295 | 292 |
| 296 // Get the text from the selection clipboard. | 293 // Get the text from the selection clipboard. |
| 297 virtual base::string16 GetSelectionClipboardText() const; | 294 virtual base::string16 GetSelectionClipboardText() const; |
| 298 | 295 |
| 299 private: | 296 private: |
| 300 friend class TextfieldTest; | 297 friend class TextfieldTestApi; |
| 301 friend class TouchSelectionControllerImplTest; | |
| 302 friend class test::WidgetTestInteractive; | |
| 303 | 298 |
| 304 // Handles a request to change the value of this text field from software | 299 // Handles a request to change the value of this text field from software |
| 305 // using an accessibility API (typically automation software, screen readers | 300 // using an accessibility API (typically automation software, screen readers |
| 306 // don't normally use this). Sets the value and clears the selection. | 301 // don't normally use this). Sets the value and clears the selection. |
| 307 void AccessibilitySetValue(const base::string16& new_value); | 302 void AccessibilitySetValue(const base::string16& new_value); |
| 308 | 303 |
| 309 // Updates the painted background color. | 304 // Updates the painted background color. |
| 310 void UpdateBackgroundColor(); | 305 void UpdateBackgroundColor(); |
| 311 | 306 |
| 312 // Does necessary updates when the text and/or cursor position changes. | 307 // Does necessary updates when the text and/or cursor position changes. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 | 434 |
| 440 // Used to bind callback functions to this object. | 435 // Used to bind callback functions to this object. |
| 441 base::WeakPtrFactory<Textfield> weak_ptr_factory_; | 436 base::WeakPtrFactory<Textfield> weak_ptr_factory_; |
| 442 | 437 |
| 443 DISALLOW_COPY_AND_ASSIGN(Textfield); | 438 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 444 }; | 439 }; |
| 445 | 440 |
| 446 } // namespace views | 441 } // namespace views |
| 447 | 442 |
| 448 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 443 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |