OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/ime/input_method_base.h" | 5 #include "ui/base/ime/input_method_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "ui/base/ime/input_method_delegate.h" | 10 #include "ui/base/ime/input_method_delegate.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (text_input_client_ != client) | 46 if (text_input_client_ != client) |
47 return; | 47 return; |
48 SetFocusedTextInputClientInternal(NULL); | 48 SetFocusedTextInputClientInternal(NULL); |
49 } | 49 } |
50 | 50 |
51 TextInputClient* InputMethodBase::GetTextInputClient() const { | 51 TextInputClient* InputMethodBase::GetTextInputClient() const { |
52 return system_toplevel_window_focused_ ? text_input_client_ : NULL; | 52 return system_toplevel_window_focused_ ? text_input_client_ : NULL; |
53 } | 53 } |
54 | 54 |
55 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { | 55 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { |
| 56 LOG(ERROR) << "auraclank: InputMethodBase::OnTextInputTypeChanged"; |
56 if (!IsTextInputClientFocused(client)) | 57 if (!IsTextInputClientFocused(client)) |
57 return; | 58 return; |
58 NotifyTextInputStateChanged(client); | 59 NotifyTextInputStateChanged(client); |
59 } | 60 } |
60 | 61 |
61 TextInputType InputMethodBase::GetTextInputType() const { | 62 TextInputType InputMethodBase::GetTextInputType() const { |
62 TextInputClient* client = GetTextInputClient(); | 63 TextInputClient* client = GetTextInputClient(); |
63 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; | 64 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; |
64 } | 65 } |
65 | 66 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ui::EventDispatchDetails InputMethodBase::DispatchKeyEventPostIME( | 108 ui::EventDispatchDetails InputMethodBase::DispatchKeyEventPostIME( |
108 ui::KeyEvent* event) const { | 109 ui::KeyEvent* event) const { |
109 ui::EventDispatchDetails details; | 110 ui::EventDispatchDetails details; |
110 if (delegate_) | 111 if (delegate_) |
111 details = delegate_->DispatchKeyEventPostIME(event); | 112 details = delegate_->DispatchKeyEventPostIME(event); |
112 return details; | 113 return details; |
113 } | 114 } |
114 | 115 |
115 void InputMethodBase::NotifyTextInputStateChanged( | 116 void InputMethodBase::NotifyTextInputStateChanged( |
116 const TextInputClient* client) { | 117 const TextInputClient* client) { |
| 118 LOG(ERROR) << "auraclank: InputMethodBase::NotifyTextInputStateChanged"; |
117 FOR_EACH_OBSERVER(InputMethodObserver, | 119 FOR_EACH_OBSERVER(InputMethodObserver, |
118 observer_list_, | 120 observer_list_, |
119 OnTextInputStateChanged(client)); | 121 OnTextInputStateChanged(client)); |
120 } | 122 } |
121 | 123 |
122 void InputMethodBase::NotifyTextInputCaretBoundsChanged( | 124 void InputMethodBase::NotifyTextInputCaretBoundsChanged( |
123 const TextInputClient* client) { | 125 const TextInputClient* client) { |
124 FOR_EACH_OBSERVER( | 126 FOR_EACH_OBSERVER( |
125 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client)); | 127 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client)); |
126 } | 128 } |
127 | 129 |
128 void InputMethodBase::SetFocusedTextInputClientInternal( | 130 void InputMethodBase::SetFocusedTextInputClientInternal( |
129 TextInputClient* client) { | 131 TextInputClient* client) { |
130 TextInputClient* old = text_input_client_; | 132 TextInputClient* old = text_input_client_; |
| 133 LOG(ERROR) << "auraclank: InputMethodBase::SetFocusedTextInputClientInternal" |
| 134 << ", old=" << old << ", client=" << client; |
131 if (old == client) | 135 if (old == client) |
132 return; | 136 return; |
133 OnWillChangeFocusedClient(old, client); | 137 OnWillChangeFocusedClient(old, client); |
134 text_input_client_ = client; // NULL allowed. | 138 text_input_client_ = client; // NULL allowed. |
135 OnDidChangeFocusedClient(old, client); | 139 OnDidChangeFocusedClient(old, client); |
136 NotifyTextInputStateChanged(text_input_client_); | 140 NotifyTextInputStateChanged(text_input_client_); |
137 } | 141 } |
138 | 142 |
139 } // namespace ui | 143 } // namespace ui |
OLD | NEW |