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_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
| 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 // This defines the callback interface for other code to be notified of changes | 24 // This defines the callback interface for other code to be notified of changes |
| 25 // in the state of a text field. | 25 // in the state of a text field. |
| 26 class VIEWS_EXPORT TextfieldController { | 26 class VIEWS_EXPORT TextfieldController { |
| 27 public: | 27 public: |
| 28 // This method is called whenever the text in the field is changed by the | 28 // This method is called whenever the text in the field is changed by the |
| 29 // user. It won't be called if the text is changed by calling | 29 // user. It won't be called if the text is changed by calling |
| 30 // Textfield::SetText() or Textfield::AppendText(). | 30 // Textfield::SetText() or Textfield::AppendText(). |
| 31 virtual void ContentsChanged(Textfield* sender, | 31 virtual void ContentsChanged(Textfield* sender, |
| 32 const base::string16& new_contents) {} | 32 const base::string16& new_contents) {} |
| 33 | 33 |
| 34 // This method is called to get notified about keystrokes in the edit. | 34 // Called to get notified about keystrokes in the edit. |
| 35 // Returns true if the message was handled and should not be processed | 35 // Returns true if the message was handled and should not be processed |
| 36 // further. If it returns false the processing continues. | 36 // further. If it returns false the processing continues. |
| 37 virtual bool HandleKeyEvent(Textfield* sender, | 37 virtual bool HandleKeyEvent(Textfield* sender, |
| 38 const ui::KeyEvent& key_event); | 38 const ui::KeyEvent& key_event); |
| 39 | 39 |
| 40 // This method is called to get notified about mouse events in the edit. | 40 // Called to get notified about mouse events in the edit. |
| 41 // Returns true if the message was handled and should not be processed | 41 // Returns true if the message was handled and should not be processed |
| 42 // further. Currently, only mouse down events are sent here. | 42 // further. Currently, only mouse down events are sent here. |
| 43 virtual bool HandleMouseEvent(Textfield* sender, | 43 virtual bool HandleMouseEvent(Textfield* sender, |
| 44 const ui::MouseEvent& mouse_event); | 44 const ui::MouseEvent& mouse_event); |
| 45 | 45 |
| 46 // Called to notify that a gesture event has occured in the | |
| 47 // textfield. Currently, only tap events are sent here. | |
| 48 virtual void NotifyOnGestureEvent(); | |
|
vadimt
2017/06/22 22:47:41
"OnGesture() {}"
Note curlies here.
newcomer
2017/06/23 23:59:37
Refactored as a side effect.
| |
| 49 | |
| 46 // Called before performing a user action that may change the textfield. | 50 // Called before performing a user action that may change the textfield. |
| 47 // It's currently only supported by Views implementation. | 51 // It's currently only supported by Views implementation. |
| 48 virtual void OnBeforeUserAction(Textfield* sender) {} | 52 virtual void OnBeforeUserAction(Textfield* sender) {} |
| 49 | 53 |
| 50 // Called after performing a user action that may change the textfield. | 54 // Called after performing a user action that may change the textfield. |
| 51 // It's currently only supported by Views implementation. | 55 // It's currently only supported by Views implementation. |
| 52 virtual void OnAfterUserAction(Textfield* sender) {} | 56 virtual void OnAfterUserAction(Textfield* sender) {} |
| 53 | 57 |
| 54 // Called after performing a Cut or Copy operation. | 58 // Called after performing a Cut or Copy operation. |
| 55 virtual void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) {} | 59 virtual void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) {} |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 79 // Gives the controller a chance to modify the context menu contents. | 83 // Gives the controller a chance to modify the context menu contents. |
| 80 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {} | 84 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {} |
| 81 | 85 |
| 82 protected: | 86 protected: |
| 83 virtual ~TextfieldController() {} | 87 virtual ~TextfieldController() {} |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace views | 90 } // namespace views |
| 87 | 91 |
| 88 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 92 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
| OLD | NEW |