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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bool InputMethodBase::IsTextInputTypeNone() const { | 97 bool InputMethodBase::IsTextInputTypeNone() const { |
98 return GetTextInputType() == TEXT_INPUT_TYPE_NONE; | 98 return GetTextInputType() == TEXT_INPUT_TYPE_NONE; |
99 } | 99 } |
100 | 100 |
101 void InputMethodBase::OnInputMethodChanged() const { | 101 void InputMethodBase::OnInputMethodChanged() const { |
102 TextInputClient* client = GetTextInputClient(); | 102 TextInputClient* client = GetTextInputClient(); |
103 if (!IsTextInputTypeNone()) | 103 if (!IsTextInputTypeNone()) |
104 client->OnInputMethodChanged(); | 104 client->OnInputMethodChanged(); |
105 } | 105 } |
106 | 106 |
107 bool InputMethodBase::DispatchKeyEventPostIME( | 107 ui::EventDispatchDetails InputMethodBase::DispatchKeyEventPostIME( |
108 const ui::KeyEvent& event) const { | 108 ui::KeyEvent* event) const { |
109 if (!delegate_) | 109 ui::EventDispatchDetails details; |
110 return false; | 110 if (delegate_) |
111 | 111 details = delegate_->DispatchKeyEventPostIME(event); |
112 return delegate_->DispatchKeyEventPostIME(event); | 112 return details; |
113 } | 113 } |
114 | 114 |
115 void InputMethodBase::NotifyTextInputStateChanged( | 115 void InputMethodBase::NotifyTextInputStateChanged( |
116 const TextInputClient* client) { | 116 const TextInputClient* client) { |
117 FOR_EACH_OBSERVER(InputMethodObserver, | 117 FOR_EACH_OBSERVER(InputMethodObserver, |
118 observer_list_, | 118 observer_list_, |
119 OnTextInputStateChanged(client)); | 119 OnTextInputStateChanged(client)); |
120 } | 120 } |
121 | 121 |
122 void InputMethodBase::NotifyTextInputCaretBoundsChanged( | 122 void InputMethodBase::NotifyTextInputCaretBoundsChanged( |
123 const TextInputClient* client) { | 123 const TextInputClient* client) { |
124 FOR_EACH_OBSERVER( | 124 FOR_EACH_OBSERVER( |
125 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client)); | 125 InputMethodObserver, observer_list_, OnCaretBoundsChanged(client)); |
126 } | 126 } |
127 | 127 |
128 void InputMethodBase::SetFocusedTextInputClientInternal( | 128 void InputMethodBase::SetFocusedTextInputClientInternal( |
129 TextInputClient* client) { | 129 TextInputClient* client) { |
130 TextInputClient* old = text_input_client_; | 130 TextInputClient* old = text_input_client_; |
131 if (old == client) | 131 if (old == client) |
132 return; | 132 return; |
133 OnWillChangeFocusedClient(old, client); | 133 OnWillChangeFocusedClient(old, client); |
134 text_input_client_ = client; // NULL allowed. | 134 text_input_client_ = client; // NULL allowed. |
135 OnDidChangeFocusedClient(old, client); | 135 OnDidChangeFocusedClient(old, client); |
136 NotifyTextInputStateChanged(text_input_client_); | 136 NotifyTextInputStateChanged(text_input_client_); |
137 } | 137 } |
138 | 138 |
139 } // namespace ui | 139 } // namespace ui |
OLD | NEW |