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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Called when a drop of dragged data happens on the textfield. This method is | 73 // Called when a drop of dragged data happens on the textfield. This method is |
74 // called before regular handling of the drop. If this returns a drag | 74 // called before regular handling of the drop. If this returns a drag |
75 // operation other than |ui::DragDropTypes::DRAG_NONE|, regular handling is | 75 // operation other than |ui::DragDropTypes::DRAG_NONE|, regular handling is |
76 // skipped. | 76 // skipped. |
77 virtual int OnDrop(const ui::OSExchangeData& data); | 77 virtual int OnDrop(const ui::OSExchangeData& data); |
78 | 78 |
79 // Gives the controller a chance to modify the context menu contents. | 79 // Gives the controller a chance to modify the context menu contents. |
80 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {} | 80 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {} |
81 | 81 |
| 82 // Returns true if the |command_id| should be enabled in the context menu. |
| 83 virtual bool IsCommandIdEnabled(int command_id) const; |
| 84 |
| 85 // Returns true if the item label for the |command_id| is dynamic in the |
| 86 // context menu. |
| 87 virtual bool IsItemForCommandIdDynamic(int command_id) const; |
| 88 |
| 89 // Returns the label string for the |coomand_id|. |
| 90 virtual base::string16 GetLabelForCommandId(int command_id) const; |
| 91 |
| 92 // Returns whether the controller handles the specified command. This is used |
| 93 // to handle a command the textfield would normally handle. For example, to |
| 94 // have the controller handle |IDS_APP_PASTE| override and return true if |
| 95 // |command_id| == |IDS_APP_PASTE|. |
| 96 // This is only invoked if the command is enabled. |
| 97 virtual bool HandlesCommand(int command_id) const; |
| 98 |
| 99 // Execute context menu command specified by |command_id|. |
| 100 virtual void ExecuteCommand(int command_id, int event_flag) {} |
| 101 |
82 protected: | 102 protected: |
83 virtual ~TextfieldController() {} | 103 virtual ~TextfieldController() {} |
84 }; | 104 }; |
85 | 105 |
86 } // namespace views | 106 } // namespace views |
87 | 107 |
88 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 108 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
OLD | NEW |