Chromium Code Reviews| Index: ui/base/ime/input_method_win.cc |
| diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc |
| index 45a0e6118ca4e2452b04d6911c1ce59c9af5a87c..53a2e11ffb2e8d2c9568a2d873b4145ef873e9cd 100644 |
| --- a/ui/base/ime/input_method_win.cc |
| +++ b/ui/base/ime/input_method_win.cc |
| @@ -33,16 +33,10 @@ InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate, |
| enabled_(false), |
| is_candidate_popup_open_(false), |
| composing_window_handle_(NULL), |
| - suppress_next_char_(false), |
| - destroyed_ptr_(nullptr) { |
| + suppress_next_char_(false) { |
| SetDelegate(delegate); |
| } |
| -InputMethodWin::~InputMethodWin() { |
| - if (destroyed_ptr_) |
| - *destroyed_ptr_ = true; |
| -} |
| - |
| void InputMethodWin::OnFocus() { |
| InputMethodBase::OnFocus(); |
| if (GetTextInputClient()) |
| @@ -104,16 +98,18 @@ bool InputMethodWin::OnUntranslatedIMEMessage( |
| return !!handled; |
| } |
| -bool InputMethodWin::DispatchKeyEvent(const ui::KeyEvent& event) { |
| - if (!event.HasNativeEvent()) |
| +void InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) { |
| + if (!event->HasNativeEvent()) |
| return DispatchFabricatedKeyEvent(event); |
|
James Su
2015/07/31 11:43:58
This looks weird, as this method doesn't have retu
Shu Chen
2015/08/03 01:44:47
Done.
|
| - const base::NativeEvent& native_key_event = event.native_event(); |
| + const base::NativeEvent& native_key_event = event->native_event(); |
| if (native_key_event.message == WM_CHAR) { |
| BOOL handled; |
| OnChar(native_key_event.hwnd, native_key_event.message, |
| native_key_event.wParam, native_key_event.lParam, &handled); |
| - return !!handled; // Don't send WM_CHAR for post event processing. |
| + if (handled) |
| + event->StopPropagation(); |
| + return; |
| } |
| // Handles ctrl-shift key to change text direction and layout alignment. |
| if (ui::IMM32Manager::IsRTLKeyboardLayoutInstalled() && |
| @@ -138,13 +134,9 @@ bool InputMethodWin::DispatchKeyEvent(const ui::KeyEvent& event) { |
| } |
| } |
| - bool destroyed = false; |
| - base::AutoReset<bool*> auto_reset(&destroyed_ptr_, &destroyed); |
| - bool handled = DispatchKeyEventPostIME(event); |
| - if (destroyed) |
| - return true; |
| - suppress_next_char_ = handled; |
| - return handled; |
| + ui::EventDispatchDetails details = DispatchKeyEventPostIME(event); |
| + if (!details.dispatcher_destroyed) |
| + suppress_next_char_ = event->stopped_propagation(); |
| } |
| void InputMethodWin::OnTextInputTypeChanged(const TextInputClient* client) { |
| @@ -591,20 +583,20 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { |
| GetActiveWindow() == toplevel_window_handle_; |
| } |
| -bool InputMethodWin::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { |
| - if (event.is_char()) { |
| +void InputMethodWin::DispatchFabricatedKeyEvent(ui::KeyEvent* event) { |
| + if (event->is_char()) { |
| if (suppress_next_char_) { |
| suppress_next_char_ = false; |
| - return true; |
| + return; |
| } |
| if (GetTextInputClient()) { |
| GetTextInputClient()->InsertChar( |
| - static_cast<base::char16>(event.key_code()), |
| + static_cast<base::char16>(event->key_code()), |
| ui::GetModifiersFromKeyState()); |
| - return true; |
| + return; |
| } |
| } |
| - return DispatchKeyEventPostIME(event); |
| + ignore_result(DispatchKeyEventPostIME(event)); |
| } |
| void InputMethodWin::ConfirmCompositionText() { |