| 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/views/ime/input_method_bridge.h" | 5 #include "ui/views/ime/input_method_bridge.h" |
| 6 | 6 |
| 7 #include "ui/base/ime/input_method.h" | 7 #include "ui/base/ime/input_method.h" |
| 8 #include "ui/base/ime/input_method_observer.h" | 8 #include "ui/base/ime/input_method_observer.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 virtual void OnTextInputTypeChanged( | 26 virtual void OnTextInputTypeChanged( |
| 27 const ui::TextInputClient* client) OVERRIDE {} | 27 const ui::TextInputClient* client) OVERRIDE {} |
| 28 virtual void OnFocus() OVERRIDE {} | 28 virtual void OnFocus() OVERRIDE {} |
| 29 virtual void OnBlur() OVERRIDE {} | 29 virtual void OnBlur() OVERRIDE {} |
| 30 virtual void OnCaretBoundsChanged( | 30 virtual void OnCaretBoundsChanged( |
| 31 const ui::TextInputClient* client) OVERRIDE {} | 31 const ui::TextInputClient* client) OVERRIDE {} |
| 32 virtual void OnTextInputStateChanged( | 32 virtual void OnTextInputStateChanged( |
| 33 const ui::TextInputClient* client) OVERRIDE {} | 33 const ui::TextInputClient* client) OVERRIDE {} |
| 34 virtual void OnInputMethodDestroyed( | 34 virtual void OnInputMethodDestroyed( |
| 35 const ui::InputMethod* input_method) OVERRIDE; | 35 const ui::InputMethod* input_method) OVERRIDE; |
| 36 virtual void OnShowImeIfNeeded() OVERRIDE {} |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 InputMethodBridge* bridge_; | 39 InputMethodBridge* bridge_; |
| 39 | 40 |
| 40 DISALLOW_COPY_AND_ASSIGN(HostObserver); | 41 DISALLOW_COPY_AND_ASSIGN(HostObserver); |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 InputMethodBridge::HostObserver::HostObserver(InputMethodBridge* bridge) | 44 InputMethodBridge::HostObserver::HostObserver(InputMethodBridge* bridge) |
| 44 : bridge_(bridge) { | 45 : bridge_(bridge) { |
| 45 bridge_->host_->AddObserver(this); | 46 bridge_->host_->AddObserver(this); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 165 |
| 165 return host_->IsActive(); | 166 return host_->IsActive(); |
| 166 } | 167 } |
| 167 | 168 |
| 168 bool InputMethodBridge::IsCandidatePopupOpen() const { | 169 bool InputMethodBridge::IsCandidatePopupOpen() const { |
| 169 DCHECK(host_); | 170 DCHECK(host_); |
| 170 | 171 |
| 171 return host_->IsCandidatePopupOpen(); | 172 return host_->IsCandidatePopupOpen(); |
| 172 } | 173 } |
| 173 | 174 |
| 175 void InputMethodBridge::ShowImeIfNeeded() const { |
| 176 DCHECK(host_); |
| 177 host_->ShowImeIfNeeded(); |
| 178 } |
| 179 |
| 174 // Overridden from TextInputClient. Forward an event from the system-wide IME | 180 // Overridden from TextInputClient. Forward an event from the system-wide IME |
| 175 // to the text input |client|, which is e.g. views::NativeTextfieldViews. | 181 // to the text input |client|, which is e.g. views::NativeTextfieldViews. |
| 176 void InputMethodBridge::SetCompositionText( | 182 void InputMethodBridge::SetCompositionText( |
| 177 const ui::CompositionText& composition) { | 183 const ui::CompositionText& composition) { |
| 178 TextInputClient* client = GetTextInputClient(); | 184 TextInputClient* client = GetTextInputClient(); |
| 179 if (client) | 185 if (client) |
| 180 client->SetCompositionText(composition); | 186 client->SetCompositionText(composition); |
| 181 } | 187 } |
| 182 | 188 |
| 183 void InputMethodBridge::ConfirmCompositionText() { | 189 void InputMethodBridge::ConfirmCompositionText() { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 OnTextInputTypeChanged(focused); | 332 OnTextInputTypeChanged(focused); |
| 327 OnCaretBoundsChanged(focused); | 333 OnCaretBoundsChanged(focused); |
| 328 } | 334 } |
| 329 | 335 |
| 330 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { | 336 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { |
| 331 return host_; | 337 return host_; |
| 332 } | 338 } |
| 333 | 339 |
| 334 | 340 |
| 335 } // namespace views | 341 } // namespace views |
| OLD | NEW |