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

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: nits. 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
« no previous file with comments | « ui/views/controls/tree/tree_view.h ('k') | ui/views/controls/tree/tree_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f103df827570fbe3da267be2f7cf303ff9c79dd7..b7918430e50b1a37e9c04d928fc15a8b67b70661 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"
#include "ui/views/resources/grit/views_resources.h"
using ui::TreeModel;
@@ -95,6 +95,12 @@ TreeView::TreeView()
TreeView::~TreeView() {
if (model_)
model_->RemoveObserver(this);
+
+ if (GetInputMethod() && selector_.get()) {
+ // TreeView should have been blurred before destroy.
+ DCHECK(selector_.get() != GetInputMethod()->GetTextInputClient());
+ }
+
if (focus_manager_) {
focus_manager_->RemoveFocusChangeListener(this);
focus_manager_ = NULL;
@@ -370,12 +376,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))
@@ -618,17 +618,19 @@ void TreeView::OnPaint(gfx::Canvas* canvas) {
}
void TreeView::OnFocus() {
- GetInputMethod()->OnFocus();
+ if (GetInputMethod())
+ GetInputMethod()->SetFocusedTextInputClient(GetPrefixSelector());
View::OnFocus();
SchedulePaintForNode(selected_node_);
// Notify the InputMethod so that it knows to query the TextInputClient.
if (GetInputMethod())
- GetInputMethod()->OnCaretBoundsChanged(this);
+ GetInputMethod()->OnCaretBoundsChanged(GetPrefixSelector());
}
void TreeView::OnBlur() {
- GetInputMethod()->OnBlur();
+ if (GetInputMethod())
+ GetInputMethod()->DetachTextInputClient(GetPrefixSelector());
SchedulePaintForNode(selected_node_);
if (selector_)
selector_->OnViewBlur();
@@ -1003,6 +1005,12 @@ bool TreeView::ExpandImpl(TreeModelNode* model_node) {
return return_value;
}
+PrefixSelector* TreeView::GetPrefixSelector() {
+ if (!selector_)
+ selector_.reset(new PrefixSelector(this));
+ return selector_.get();
+}
+
// InternalNode ----------------------------------------------------------------
TreeView::InternalNode::InternalNode()
« no previous file with comments | « ui/views/controls/tree/tree_view.h ('k') | ui/views/controls/tree/tree_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698