| 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/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/input_method_observer.h" | 9 #include "ui/base/ime/input_method_observer.h" |
| 10 #include "ui/base/ime/text_input_client.h" | 10 #include "ui/base/ime/text_input_client.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 TextInputClient* InputMethodBase::GetTextInputClient() const { | 67 TextInputClient* InputMethodBase::GetTextInputClient() const { |
| 68 return system_toplevel_window_focused_ ? text_input_client_ : NULL; | 68 return system_toplevel_window_focused_ ? text_input_client_ : NULL; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { | 71 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { |
| 72 if (!IsTextInputClientFocused(client)) | 72 if (!IsTextInputClientFocused(client)) |
| 73 return; | 73 return; |
| 74 NotifyTextInputStateChanged(client); | 74 NotifyTextInputStateChanged(client); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void InputMethodBase::OnCaretBoundsChanged(const TextInputClient* client) { |
| 78 if (!IsTextInputClientFocused(client)) |
| 79 return; |
| 80 FOR_EACH_OBSERVER(InputMethodObserver, |
| 81 observer_list_, |
| 82 OnCaretBoundsChanged(client)); |
| 83 } |
| 84 |
| 85 void InputMethodBase::OnInputLocaleChanged() { |
| 86 FOR_EACH_OBSERVER(InputMethodObserver, |
| 87 observer_list_, |
| 88 OnInputLocaleChanged()); |
| 89 } |
| 90 |
| 77 TextInputType InputMethodBase::GetTextInputType() const { | 91 TextInputType InputMethodBase::GetTextInputType() const { |
| 78 TextInputClient* client = GetTextInputClient(); | 92 TextInputClient* client = GetTextInputClient(); |
| 79 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; | 93 return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; |
| 80 } | 94 } |
| 81 | 95 |
| 82 TextInputMode InputMethodBase::GetTextInputMode() const { | 96 TextInputMode InputMethodBase::GetTextInputMode() const { |
| 83 TextInputClient* client = GetTextInputClient(); | 97 TextInputClient* client = GetTextInputClient(); |
| 84 return client ? client->GetTextInputMode() : TEXT_INPUT_MODE_DEFAULT; | 98 return client ? client->GetTextInputMode() : TEXT_INPUT_MODE_DEFAULT; |
| 85 } | 99 } |
| 86 | 100 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 TextInputClient* old = text_input_client_; | 149 TextInputClient* old = text_input_client_; |
| 136 if (old == client) | 150 if (old == client) |
| 137 return; | 151 return; |
| 138 OnWillChangeFocusedClient(old, client); | 152 OnWillChangeFocusedClient(old, client); |
| 139 text_input_client_ = client; // NULL allowed. | 153 text_input_client_ = client; // NULL allowed. |
| 140 OnDidChangeFocusedClient(old, client); | 154 OnDidChangeFocusedClient(old, client); |
| 141 NotifyTextInputStateChanged(text_input_client_); | 155 NotifyTextInputStateChanged(text_input_client_); |
| 142 } | 156 } |
| 143 | 157 |
| 144 } // namespace ui | 158 } // namespace ui |
| OLD | NEW |