summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-24 15:30:34 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-24 15:30:34 +0000
commitb824b244b2c55a0c436304b0d5a50c643642e26b (patch)
tree77abe4434025b8bb32dd6e494fb1e9cac967f917
parent14ddecf6d7cbf70df1b5228987218290463ab954 (diff)
downloadchromium_src-b824b244b2c55a0c436304b0d5a50c643642e26b.zip
chromium_src-b824b244b2c55a0c436304b0d5a50c643642e26b.tar.gz
chromium_src-b824b244b2c55a0c436304b0d5a50c643642e26b.tar.bz2
Fix the problem that the active panel does not get focus on Mac
The problem is caused by our workaround to remove the web contents view and then put it back to solve the whitestrip issue for the title-only panel. We need to tell the render widget host view to accept the focus when the web contents view is added back. BUG=277127 TEST=Manual test by creating a panel with initial focus Review URL: https://chromiumcodereview.appspot.com/23075024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219456 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm12
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
index 126a8ff..44cd721c 100644
--- a/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
+++ b/chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm
@@ -831,8 +831,18 @@ NSCursor* LoadWebKitCursor(WebKit::WebCursorInfo::Type type) {
if ([contentView superview])
[contentView removeFromSuperview];
} else {
- if (![contentView superview])
+ if (![contentView superview]) {
[[[self window] contentView] addSubview:contentView];
+
+ // When the web contents view is put back, we need to tell its render
+ // widget host view to accept focus.
+ content::RenderWidgetHostView* rwhv =
+ webContents->GetRenderWidgetHostView();
+ if (rwhv) {
+ [[self window] makeFirstResponder:rwhv->GetNativeView()];
+ rwhv->SetActive([[self window] isMainWindow]);
+ }
+ }
}
}