Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: ui/views/controls/textfield/textfield.h

Issue 2007503002: Views: Replace resource ids with ui::TextEditCommand enum for text editing commands in Textfield. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added file deleted during rename. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/textfield/textfield.h
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
index ef815abf46b4cade36e17c50aeb3f77c345081b2..c3a39453379df156400843845b7172e75942223b 100644
--- a/ui/views/controls/textfield/textfield.h
+++ b/ui/views/controls/textfield/textfield.h
@@ -203,9 +203,6 @@ class VIEWS_EXPORT Textfield : public View,
// Set the accessible name of the text field.
void SetAccessibleName(const base::string16& name);
- // Performs the action associated with the specified command id.
- void ExecuteCommand(int command_id);
-
// Returns whether there is a drag operation originating from the textfield.
bool HasTextBeingDragged();
@@ -306,8 +303,8 @@ class VIEWS_EXPORT Textfield : public View,
base::i18n::TextDirection direction) override;
void ExtendSelectionAndDelete(size_t before, size_t after) override;
void EnsureCaretInRect(const gfx::Rect& rect) override;
- bool IsEditCommandEnabled(int command_id) override;
- void SetEditCommandForNextKeyEvent(int command_id) override;
+ bool IsEditCommandEnabled(ui::TextEditCommand command) const override;
+ void SetEditCommandForNextKeyEvent(ui::TextEditCommand command) override;
protected:
// Inserts or appends a character in response to an IME operation.
@@ -321,6 +318,17 @@ class VIEWS_EXPORT Textfield : public View,
// Get the text from the selection clipboard.
virtual base::string16 GetSelectionClipboardText() const;
+ ui::TextEditCommand scheduled_edit_command() const {
+ return scheduled_edit_command_;
+ }
+
+ void reset_scheduled_edit_command() {
+ scheduled_edit_command_ = ui::TextEditCommand::INVALID_COMMAND;
+ }
+
+ // Performs the given |command|.
+ virtual void ExecuteEditCommand(ui::TextEditCommand command);
+
private:
friend class TextfieldTestApi;
@@ -395,11 +403,12 @@ class VIEWS_EXPORT Textfield : public View,
// This is the current listener for events from this Textfield.
TextfieldController* controller_;
- // If non-zero, an edit command to execute on the next key event. When set,
- // the key event is still passed to |controller_|, but otherwise ignored in
- // favor of the edit command. Set via SetEditCommandForNextKeyEvent() during
- // dispatch of that key event (see comment in TextInputClient).
- int scheduled_edit_command_;
+ // An edit command to execute on the next key event. When set to a valid
+ // command, the key event is still passed to |controller_|, but otherwise
+ // ignored in favor of the edit command. Set via
+ // SetEditCommandForNextKeyEvent() during dispatch of that key event (see
+ // comment in TextInputClient).
+ ui::TextEditCommand scheduled_edit_command_;
// True if this Textfield cannot accept input and is read-only.
bool read_only_;

Powered by Google App Engine
This is Rietveld 408576698