Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(962)

Unified Diff: ui/views/cocoa/bridged_content_view.mm

Issue 1759913004: MacViews: Handling changing of first responder inside NativeWidgetMac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment for test. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/widget/native_widget_mac_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/cocoa/bridged_content_view.mm
diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm
index 6022a44723bf99d9873d04bd6dcbebdb7bc66697..e2cd30e2137ec183aa2d7a04047ca1c5abf70bd7 100644
--- a/ui/views/cocoa/bridged_content_view.mm
+++ b/ui/views/cocoa/bridged_content_view.mm
@@ -407,6 +407,20 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client,
return YES;
}
+- (BOOL)becomeFirstResponder {
+ BOOL result = [super becomeFirstResponder];
+ if (result && hostedView_)
+ hostedView_->GetWidget()->GetFocusManager()->RestoreFocusedView();
+ return result;
+}
+
+- (BOOL)resignFirstResponder {
+ BOOL result = [super resignFirstResponder];
+ if (result && hostedView_)
+ hostedView_->GetWidget()->GetFocusManager()->StoreFocusedView(true);
+ return result;
+}
+
- (void)viewDidMoveToWindow {
// When this view is added to a window, AppKit calls setFrameSize before it is
// added to the window, so the behavior in setFrameSize is not triggered.
« no previous file with comments | « no previous file | ui/views/widget/native_widget_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698