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

Unified Diff: ui/views/controls/tree/tree_view.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased & removed views::View::GetTextInputClient & removed GetFocusedTextInputClient. 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/tree/tree_view.cc
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc
index e3e6194e37dc52d3e3dbf5a6f799efdc1bf2cd07..8b6ff4dd0f1bd6c296d3f44119611ee88f4c160d 100644
--- a/ui/views/controls/tree/tree_view.cc
+++ b/ui/views/controls/tree/tree_view.cc
@@ -9,6 +9,7 @@
#include "base/i18n/rtl.h"
#include "base/message_loop/message_loop.h"
#include "ui/accessibility/ax_view_state.h"
+#include "ui/base/ime/input_method.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_codes.h"
@@ -23,7 +24,6 @@
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/controls/tree/tree_view_controller.h"
-#include "ui/views/ime/input_method.h"
using ui::TreeModel;
using ui::TreeModelNode;
@@ -98,6 +98,8 @@ TreeView::~TreeView() {
focus_manager_->RemoveFocusChangeListener(this);
focus_manager_ = NULL;
}
+ if (selector_ && GetInputMethod())
+ GetInputMethod()->DetachTextInputClient(selector_.get());
}
View* TreeView::CreateParentIfNecessary() {
@@ -339,6 +341,12 @@ int TreeView::GetRowForNode(ui::TreeModelNode* node) {
return GetRowForInternalNode(internal_node, &depth);
}
+ui::TextInputClient* TreeView::GetTextInputClient() {
+ if (!selector_)
+ selector_.reset(new PrefixSelector(this));
+ return selector_.get();
+}
+
void TreeView::Layout() {
int width = preferred_size_.width();
int height = preferred_size_.height();
@@ -369,12 +377,6 @@ bool TreeView::OnMousePressed(const ui::MouseEvent& event) {
return OnClickOrTap(event);
}
-ui::TextInputClient* TreeView::GetTextInputClient() {
- if (!selector_)
- selector_.reset(new PrefixSelector(this));
- return selector_.get();
-}
-
void TreeView::OnGestureEvent(ui::GestureEvent* event) {
if (event->type() == ui::ET_GESTURE_TAP) {
if (OnClickOrTap(*event))
@@ -617,17 +619,19 @@ void TreeView::OnPaint(gfx::Canvas* canvas) {
}
void TreeView::OnFocus() {
- GetInputMethod()->OnFocus();
+ if (GetInputMethod())
+ GetInputMethod()->SetFocusedTextInputClient(GetTextInputClient());
View::OnFocus();
SchedulePaintForNode(selected_node_);
// Notify the InputMethod so that it knows to query the TextInputClient.
if (GetInputMethod())
- GetInputMethod()->OnCaretBoundsChanged(this);
+ GetInputMethod()->OnCaretBoundsChanged(GetTextInputClient());
}
void TreeView::OnBlur() {
- GetInputMethod()->OnBlur();
+ if (GetInputMethod())
+ GetInputMethod()->DetachTextInputClient(GetTextInputClient());
SchedulePaintForNode(selected_node_);
if (selector_)
selector_->OnViewBlur();

Powered by Google App Engine
This is Rietveld 408576698