| 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" |
| 11 #include "ui/base/ime/input_method_observer.h" | 11 #include "ui/base/ime/input_method_observer.h" |
| 12 #include "ui/base/ime/text_input_client.h" | 12 #include "ui/base/ime/text_input_client.h" |
| 13 #include "ui/base/ime/text_input_focus_manager.h" | 13 #include "ui/base/ime/text_input_focus_manager.h" |
| 14 #include "ui/base/ui_base_switches_util.h" | 14 #include "ui/base/ui_base_switches_util.h" |
| 15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 InputMethodBase::InputMethodBase() | 19 InputMethodBase::InputMethodBase() |
| 20 : delegate_(NULL), | 20 : delegate_(NULL), |
| 21 text_input_client_(NULL), | 21 text_input_client_(NULL), |
| 22 system_toplevel_window_focused_(false) { | 22 system_toplevel_window_focused_(false), |
| 23 on_screen_keyboard_supported_(false) { |
| 23 } | 24 } |
| 24 | 25 |
| 25 InputMethodBase::~InputMethodBase() { | 26 InputMethodBase::~InputMethodBase() { |
| 26 FOR_EACH_OBSERVER(InputMethodObserver, | 27 FOR_EACH_OBSERVER(InputMethodObserver, |
| 27 observer_list_, | 28 observer_list_, |
| 28 OnInputMethodDestroyed(this)); | 29 OnInputMethodDestroyed(this)); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) { | 32 void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) { |
| 32 delegate_ = delegate; | 33 delegate_ = delegate; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 88 |
| 88 bool InputMethodBase::CanComposeInline() const { | 89 bool InputMethodBase::CanComposeInline() const { |
| 89 TextInputClient* client = GetTextInputClient(); | 90 TextInputClient* client = GetTextInputClient(); |
| 90 return client ? client->CanComposeInline() : true; | 91 return client ? client->CanComposeInline() : true; |
| 91 } | 92 } |
| 92 | 93 |
| 93 void InputMethodBase::ShowImeIfNeeded() { | 94 void InputMethodBase::ShowImeIfNeeded() { |
| 94 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnShowImeIfNeeded()); | 95 FOR_EACH_OBSERVER(InputMethodObserver, observer_list_, OnShowImeIfNeeded()); |
| 95 } | 96 } |
| 96 | 97 |
| 98 void InputMethodBase::SetSupportsOnScreenKeyboard(bool supported) { |
| 99 on_screen_keyboard_supported_ = supported; |
| 100 } |
| 101 |
| 102 bool InputMethodBase::SupportsOnScreenKeyboard() const { |
| 103 return on_screen_keyboard_supported_; |
| 104 } |
| 105 |
| 97 void InputMethodBase::AddObserver(InputMethodObserver* observer) { | 106 void InputMethodBase::AddObserver(InputMethodObserver* observer) { |
| 98 observer_list_.AddObserver(observer); | 107 observer_list_.AddObserver(observer); |
| 99 } | 108 } |
| 100 | 109 |
| 101 void InputMethodBase::RemoveObserver(InputMethodObserver* observer) { | 110 void InputMethodBase::RemoveObserver(InputMethodObserver* observer) { |
| 102 observer_list_.RemoveObserver(observer); | 111 observer_list_.RemoveObserver(observer); |
| 103 } | 112 } |
| 104 | 113 |
| 105 bool InputMethodBase::IsTextInputClientFocused(const TextInputClient* client) { | 114 bool InputMethodBase::IsTextInputClientFocused(const TextInputClient* client) { |
| 106 return client && (client == GetTextInputClient()); | 115 return client && (client == GetTextInputClient()); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (TextInputClient* text_input_client = GetTextInputClient()) | 188 if (TextInputClient* text_input_client = GetTextInputClient()) |
| 180 text_input_client->OnCandidateWindowUpdated(); | 189 text_input_client->OnCandidateWindowUpdated(); |
| 181 } | 190 } |
| 182 | 191 |
| 183 void InputMethodBase::CandidateWindowHiddenCallback() { | 192 void InputMethodBase::CandidateWindowHiddenCallback() { |
| 184 if (TextInputClient* text_input_client = GetTextInputClient()) | 193 if (TextInputClient* text_input_client = GetTextInputClient()) |
| 185 text_input_client->OnCandidateWindowHidden(); | 194 text_input_client->OnCandidateWindowHidden(); |
| 186 } | 195 } |
| 187 | 196 |
| 188 } // namespace ui | 197 } // namespace ui |
| OLD | NEW |