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

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 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/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index af332fbfa27b32db1b85c64ac2ed73ac1a6c8c07..53d28bc0610f5c85f4e6adcb3b5e2441e1687e97 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/accessibility/ax_view_state.h"
+#include "ui/base/ime/input_method.h"
#include "ui/base/models/combobox_model.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/event.h"
@@ -32,7 +33,6 @@
#include "ui/views/controls/menu/submenu_view.h"
#include "ui/views/controls/prefix_selector.h"
#include "ui/views/controls/textfield/textfield.h"
-#include "ui/views/ime/input_method.h"
#include "ui/views/mouse_constants.h"
#include "ui/views/painter.h"
#include "ui/views/resources/grit/views_resources.h"
@@ -335,12 +335,6 @@ void Combobox::SetInvalid(bool invalid) {
SchedulePaint();
}
-ui::TextInputClient* Combobox::GetTextInputClient() {
- if (!selector_)
- selector_.reset(new PrefixSelector(this));
- return selector_.get();
-}
-
void Combobox::Layout() {
PrefixDelegate::Layout();
@@ -540,14 +534,18 @@ void Combobox::OnPaint(gfx::Canvas* canvas) {
}
void Combobox::OnFocus() {
- GetInputMethod()->OnFocus();
+ if (GetInputMethod())
+ GetInputMethod()->SetFocusedTextInputClient(GetPrefixSelector());
+
View::OnFocus();
// Border renders differently when focused.
SchedulePaint();
}
void Combobox::OnBlur() {
- GetInputMethod()->OnBlur();
+ if (GetInputMethod())
+ GetInputMethod()->DetachTextInputClient(GetPrefixSelector());
+
if (selector_)
selector_->OnViewBlur();
// Border renders differently when focused.
@@ -865,4 +863,10 @@ gfx::Size Combobox::ArrowSize() const {
ignored);
}
+PrefixSelector* Combobox::GetPrefixSelector() {
+ if (!selector_)
+ selector_.reset(new PrefixSelector(this));
+ return selector_.get();
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698