| Index: ui/views/ime/input_method_bridge.cc
|
| diff --git a/ui/views/ime/input_method_bridge.cc b/ui/views/ime/input_method_bridge.cc
|
| index 1ca16315a4e874a138a8fdb1a8b6979e982212bd..8eb7807fa5c93090e2aeac2906d1ca0f86066369 100644
|
| --- a/ui/views/ime/input_method_bridge.cc
|
| +++ b/ui/views/ime/input_method_bridge.cc
|
| @@ -15,12 +15,11 @@ InputMethodBridge::InputMethodBridge(internal::InputMethodDelegate* delegate,
|
| ui::InputMethod* host)
|
| : host_(host),
|
| context_focused_(false) {
|
| - DCHECK(host_);
|
| set_delegate(delegate);
|
| }
|
|
|
| InputMethodBridge::~InputMethodBridge() {
|
| - if (host_->GetTextInputClient() == this)
|
| + if (host_ && host_->GetTextInputClient() == this)
|
| host_->SetFocusedTextInputClient(NULL);
|
| }
|
|
|
| @@ -34,7 +33,8 @@ void InputMethodBridge::OnFocus() {
|
|
|
| // Ask the system-wide IME to send all TextInputClient messages to |this|
|
| // object.
|
| - host_->SetFocusedTextInputClient(this);
|
| + if (host_)
|
| + host_->SetFocusedTextInputClient(this);
|
|
|
| // TODO(yusukes): We don't need to call OnTextInputTypeChanged() once we move
|
| // text input type tracker code to ui::InputMethodBase.
|
| @@ -47,7 +47,7 @@ void InputMethodBridge::OnBlur() {
|
|
|
| ConfirmCompositionText();
|
| InputMethodBase::OnBlur();
|
| - if (host_->GetTextInputClient() == this)
|
| + if (host_ && host_->GetTextInputClient() == this)
|
| host_->SetFocusedTextInputClient(NULL);
|
| }
|
|
|
| @@ -61,31 +61,31 @@ void InputMethodBridge::DispatchKeyEvent(const KeyEvent& key) {
|
| }
|
|
|
| void InputMethodBridge::OnTextInputTypeChanged(View* view) {
|
| - if (IsViewFocused(view))
|
| + if (host_ && IsViewFocused(view))
|
| host_->OnTextInputTypeChanged(this);
|
| InputMethodBase::OnTextInputTypeChanged(view);
|
| }
|
|
|
| void InputMethodBridge::OnCaretBoundsChanged(View* view) {
|
| - if (IsViewFocused(view) && !IsTextInputTypeNone())
|
| + if (host_ && IsViewFocused(view) && !IsTextInputTypeNone())
|
| host_->OnCaretBoundsChanged(this);
|
| }
|
|
|
| void InputMethodBridge::CancelComposition(View* view) {
|
| - if (IsViewFocused(view))
|
| + if (host_ && IsViewFocused(view))
|
| host_->CancelComposition(this);
|
| }
|
|
|
| std::string InputMethodBridge::GetInputLocale() {
|
| - return host_->GetInputLocale();
|
| + return host_ ? host_->GetInputLocale() : "";
|
| }
|
|
|
| base::i18n::TextDirection InputMethodBridge::GetInputTextDirection() {
|
| - return host_->GetInputTextDirection();
|
| + return host_ ? host_->GetInputTextDirection() : base::i18n::UNKNOWN_DIRECTION;
|
| }
|
|
|
| bool InputMethodBridge::IsActive() {
|
| - return host_->IsActive();
|
| + return host_ ? host_->IsActive() : false;
|
| }
|
|
|
| // Overridden from TextInputClient. Forward an event from the system-wide IME
|
|
|