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 2116ba36d86f66a3c65c025d86a1acea82f9536b..5bfe7bcb13df9eee35ac19a04f001403f6e494df 100644 |
| --- a/ui/views/cocoa/bridged_native_widget.mm |
| +++ b/ui/views/cocoa/bridged_native_widget.mm |
| @@ -5,7 +5,8 @@ |
| #import "ui/views/cocoa/bridged_native_widget.h" |
| #include "base/logging.h" |
| -#import "ui/views/cocoa/bridged_content_view.h" |
| +#include "ui/views/cocoa/bridged_content_view.h" |
|
tapted
2014/06/17 13:23:56
include -> import. Typically import is used if a h
Andre
2014/06/18 21:48:35
Done.
|
| +#include "ui/views/view.h" |
| namespace views { |
| @@ -25,16 +26,35 @@ void BridgedNativeWidget::SetRootView(views::View* view) { |
| if (view == [bridged_view_ view]) |
| return; |
| + if ([bridged_view_ view]) |
| + [bridged_view_ view]->GetFocusManager()->RemoveFocusChangeListener(this); |
|
tapted
2014/06/17 13:23:56
I think this belongs in [BridgedContentView clearV
Andre
2014/06/18 21:48:35
Done.
|
| + |
| [bridged_view_ clearView]; |
| bridged_view_.reset(); |
| // Note that there can still be references to the old |bridged_view_| |
| // floating around in Cocoa libraries at this point. However, references to |
| // the old views::View will be gone, so any method calls will become no-ops. |
| - if (view) |
| + if (view) { |
| bridged_view_.reset([[BridgedContentView alloc] initWithView:view]); |
| + view->GetFocusManager()->AddFocusChangeListener(this); |
| + } |
| [window_ setContentView:bridged_view_]; |
| [window_ makeFirstResponder:bridged_view_]; |
| } |
| +// FocusChangeListener implementation. |
|
tapted
2014/06/17 13:23:56
I usually skip these comments for C++ implementati
Andre
2014/06/18 21:48:35
Done.
|
| + |
| +void BridgedNativeWidget::OnWillChangeFocus(View* focused_before, |
| + View* focused_now) { |
| +} |
| + |
| +void BridgedNativeWidget::OnDidChangeFocus(View* focused_before, |
| + View* focused_now) { |
| + if (focused_now) |
|
tapted
2014/06/17 13:23:56
nit: I'd probably write this
ui::TextInputClien
Andre
2014/06/18 21:48:35
Done.
|
| + [bridged_view_ setTextInputClient:focused_now->GetTextInputClient()]; |
| + else |
| + [bridged_view_ setTextInputClient:NULL]; |
| +} |
| + |
| } // namespace views |