summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
authorandresantoso@chromium.org <andresantoso@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 01:36:47 +0000
committerandresantoso@chromium.org <andresantoso@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 01:36:47 +0000
commit3236ca0c85294a4bdbf04505a42d47e55a1bfae4 (patch)
treef2fb7cdf81d6e39d7afff97c1f0fba10f08251b4 /ui/views
parent45c6548105192a53e77aec48eaf1873cc1a8cbbc (diff)
downloadchromium_src-3236ca0c85294a4bdbf04505a42d47e55a1bfae4.zip
chromium_src-3236ca0c85294a4bdbf04505a42d47e55a1bfae4.tar.gz
chromium_src-3236ca0c85294a4bdbf04505a42d47e55a1bfae4.tar.bz2
MacViews: Extend TextInputClient protocol with support for editing commands.
Extend TextInputClient to support validating and executing editing commands, such as IDS_DELETE_BACKWARD, IDS_MOVE_RIGHT, IDS_APP_PASTE. This will be used for implementing Textfield editing for the Mac port of Views. BUG=374077 Review URL: https://codereview.chromium.org/302293003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275294 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/controls/prefix_selector.cc7
-rw-r--r--ui/views/controls/prefix_selector.h3
-rw-r--r--ui/views/controls/textfield/textfield.cc8
-rw-r--r--ui/views/controls/textfield/textfield.h2
-rw-r--r--ui/views/ime/input_method_bridge.cc7
-rw-r--r--ui/views/ime/input_method_bridge.h2
6 files changed, 29 insertions, 0 deletions
diff --git a/ui/views/controls/prefix_selector.cc b/ui/views/controls/prefix_selector.cc
index 6ac51fd..c901edd 100644
--- a/ui/views/controls/prefix_selector.cc
+++ b/ui/views/controls/prefix_selector.cc
@@ -143,6 +143,13 @@ void PrefixSelector::OnCandidateWindowUpdated() {
void PrefixSelector::OnCandidateWindowHidden() {
}
+bool PrefixSelector::IsEditingCommandEnabled(int command_id) {
+ return false;
+}
+
+void PrefixSelector::ExecuteEditingCommand(int command_id) {
+}
+
void PrefixSelector::OnTextInput(const base::string16& text) {
// Small hack to filter out 'tab' and 'enter' input, as the expectation is
// that they are control characters and will not affect the currently-active
diff --git a/ui/views/controls/prefix_selector.h b/ui/views/controls/prefix_selector.h
index a7ba507..255046f 100644
--- a/ui/views/controls/prefix_selector.h
+++ b/ui/views/controls/prefix_selector.h
@@ -55,6 +55,9 @@ class VIEWS_EXPORT PrefixSelector : public ui::TextInputClient {
virtual void OnCandidateWindowUpdated() OVERRIDE;
virtual void OnCandidateWindowHidden() OVERRIDE;
+ virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE;
+ virtual void ExecuteEditingCommand(int command_id) OVERRIDE;
+
private:
// Invoked when text is typed. Tries to change the selection appropriately.
void OnTextInput(const base::string16& text);
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index cceb572..12f6ed9 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -1499,6 +1499,14 @@ void Textfield::OnCandidateWindowUpdated() {}
void Textfield::OnCandidateWindowHidden() {}
+bool Textfield::IsEditingCommandEnabled(int command_id) {
+ return IsCommandIdEnabled(command_id);
+}
+
+void Textfield::ExecuteEditingCommand(int command_id) {
+ ExecuteCommand(command_id);
+}
+
////////////////////////////////////////////////////////////////////////////////
// Textfield, protected:
diff --git a/ui/views/controls/textfield/textfield.h b/ui/views/controls/textfield/textfield.h
index f01a5e4..e836177 100644
--- a/ui/views/controls/textfield/textfield.h
+++ b/ui/views/controls/textfield/textfield.h
@@ -295,6 +295,8 @@ class VIEWS_EXPORT Textfield : public View,
virtual void OnCandidateWindowShown() OVERRIDE;
virtual void OnCandidateWindowUpdated() OVERRIDE;
virtual void OnCandidateWindowHidden() OVERRIDE;
+ virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE;
+ virtual void ExecuteEditingCommand(int command_id) OVERRIDE;
protected:
// Returns the TextfieldModel's text/cursor/selection rendering model.
diff --git a/ui/views/ime/input_method_bridge.cc b/ui/views/ime/input_method_bridge.cc
index 5fc7fde..97b0400 100644
--- a/ui/views/ime/input_method_bridge.cc
+++ b/ui/views/ime/input_method_bridge.cc
@@ -319,6 +319,13 @@ void InputMethodBridge::OnCandidateWindowUpdated() {
void InputMethodBridge::OnCandidateWindowHidden() {
}
+bool InputMethodBridge::IsEditingCommandEnabled(int command_id) {
+ return false;
+}
+
+void InputMethodBridge::ExecuteEditingCommand(int command_id) {
+}
+
// Overridden from FocusChangeListener.
void InputMethodBridge::OnWillChangeFocus(View* focused_before, View* focused) {
if (HasCompositionText()) {
diff --git a/ui/views/ime/input_method_bridge.h b/ui/views/ime/input_method_bridge.h
index dbc9765..cdabecd 100644
--- a/ui/views/ime/input_method_bridge.h
+++ b/ui/views/ime/input_method_bridge.h
@@ -79,6 +79,8 @@ class InputMethodBridge : public InputMethodBase,
virtual void OnCandidateWindowShown() OVERRIDE;
virtual void OnCandidateWindowUpdated() OVERRIDE;
virtual void OnCandidateWindowHidden() OVERRIDE;
+ virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE;
+ virtual void ExecuteEditingCommand(int command_id) OVERRIDE;
// Overridden from FocusChangeListener.
virtual void OnWillChangeFocus(View* focused_before, View* focused) OVERRIDE;