| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/base/ime/input_method_delegate.h" | 8 #include "ui/base/ime/input_method_delegate.h" |
| 9 #include "ui/base/ime/text_input_client.h" | 9 #include "ui/base/ime/text_input_client.h" |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 bool InputMethodBase::IsTextInputClientFocused(const TextInputClient* client) { | 64 bool InputMethodBase::IsTextInputClientFocused(const TextInputClient* client) { |
| 65 return client && (client == GetTextInputClient()); | 65 return client && (client == GetTextInputClient()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool InputMethodBase::IsTextInputTypeNone() const { | 68 bool InputMethodBase::IsTextInputTypeNone() const { |
| 69 return GetTextInputType() == TEXT_INPUT_TYPE_NONE; | 69 return GetTextInputType() == TEXT_INPUT_TYPE_NONE; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void InputMethodBase::OnInputMethodChanged() const { | 72 void InputMethodBase::OnInputMethodChanged() const { |
| 73 TextInputClient* client = GetTextInputClient(); | 73 TextInputClient* client = GetTextInputClient(); |
| 74 if (client && client->GetTextInputType() != TEXT_INPUT_TYPE_NONE) | 74 if (!IsTextInputTypeNone()) |
| 75 client->OnInputMethodChanged(); | 75 client->OnInputMethodChanged(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void InputMethodBase::DispatchKeyEventPostIME( | 78 void InputMethodBase::DispatchKeyEventPostIME( |
| 79 const base::NativeEvent& native_event) const { | 79 const base::NativeEvent& native_event) const { |
| 80 if (delegate_) | 80 if (delegate_) |
| 81 delegate_->DispatchKeyEventPostIME(native_event); | 81 delegate_->DispatchKeyEventPostIME(native_event); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void InputMethodBase::DispatchFabricatedKeyEventPostIME(EventType type, | 84 void InputMethodBase::DispatchFabricatedKeyEventPostIME(EventType type, |
| 85 KeyboardCode key_code, | 85 KeyboardCode key_code, |
| 86 int flags) const { | 86 int flags) const { |
| 87 if (delegate_) | 87 if (delegate_) |
| 88 delegate_->DispatchFabricatedKeyEventPostIME(type, key_code, flags); | 88 delegate_->DispatchFabricatedKeyEventPostIME(type, key_code, flags); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace ui | 91 } // namespace ui |
| OLD | NEW |