Chromium Code Reviews| Index: ui/views/cocoa/bridged_native_widget.mm |
| diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm |
| index c5fa0a2c5ca7cb9376e0e21eead05b14dd0d8cd8..72c2a297170e97f3078662814f76d8bd023b58d9 100644 |
| --- a/ui/views/cocoa/bridged_native_widget.mm |
| +++ b/ui/views/cocoa/bridged_native_widget.mm |
| @@ -25,8 +25,6 @@ |
| #include "ui/views/cocoa/tooltip_manager_mac.h" |
| #import "ui/views/cocoa/views_nswindow_delegate.h" |
| #import "ui/views/cocoa/widget_owner_nswindow_adapter.h" |
| -#include "ui/views/ime/input_method_bridge.h" |
| -#include "ui/views/ime/null_input_method.h" |
| #include "ui/views/view.h" |
| #include "ui/views/views_delegate.h" |
| #include "ui/views/widget/native_widget_mac.h" |
| @@ -707,15 +705,10 @@ void BridgedNativeWidget::OnSizeConstraintsChanged() { |
| shows_fullscreen_controls); |
| } |
| -InputMethod* BridgedNativeWidget::CreateInputMethod() { |
| - return new InputMethodBridge(this, GetHostInputMethod(), true); |
| -} |
| - |
| -ui::InputMethod* BridgedNativeWidget::GetHostInputMethod() { |
| +ui::InputMethod* BridgedNativeWidget::GetInputMethod() { |
| if (!input_method_) { |
| - // Delegate is NULL because Mac IME does not need DispatchKeyEventPostIME |
| - // callbacks. |
| - input_method_ = ui::CreateInputMethod(NULL, nil); |
| + input_method_ = ui::CreateInputMethod(this, nil); |
| + input_method_->OnFocus(); |
|
tapted
2015/06/29 04:57:21
Can you add a comment about this line?
It seems o
Shu Chen
2015/06/29 06:05:57
ui::InputMethod::OnBlur() only gets called in Desk
tapted
2015/06/29 06:34:48
Acknowledged. (we discussed this out of band - "al
|
| } |
| return input_method_.get(); |
| } |
| @@ -757,11 +750,12 @@ void BridgedNativeWidget::CreateLayer(ui::LayerType layer_type, |
| //////////////////////////////////////////////////////////////////////////////// |
| // BridgedNativeWidget, internal::InputMethodDelegate: |
| -void BridgedNativeWidget::DispatchKeyEventPostIME(const ui::KeyEvent& key) { |
| +bool BridgedNativeWidget::DispatchKeyEventPostIME(const ui::KeyEvent& key) { |
| DCHECK(focus_manager_); |
| native_widget_mac_->GetWidget()->OnKeyEvent(const_cast<ui::KeyEvent*>(&key)); |
| if (!key.handled()) |
| focus_manager_->OnKeyEvent(key); |
|
tapted
2015/06/29 04:57:21
BridgedContentView currently ignores the return va
Shu Chen
2015/06/29 06:05:57
Done.
|
| + return key.handled(); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -784,9 +778,12 @@ void BridgedNativeWidget::OnWillChangeFocus(View* focused_before, |
| void BridgedNativeWidget::OnDidChangeFocus(View* focused_before, |
| View* focused_now) { |
| - ui::TextInputClient* input_client = |
| - focused_now ? focused_now->GetTextInputClient() : NULL; |
| - [bridged_view_ setTextInputClient:input_client]; |
| + ui::InputMethod* input_method = |
| + native_widget_mac_->GetWidget()->GetInputMethod(); |
| + if (input_method) { |
| + ui::TextInputClient* input_client = input_method->GetTextInputClient(); |
| + [bridged_view_ setTextInputClient:input_client]; |
| + } |
| } |
| //////////////////////////////////////////////////////////////////////////////// |