diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-23 19:02:21 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-23 19:02:21 +0000 |
commit | 4a0ae6fde4030129a30d861e69f679f924a7df02 (patch) | |
tree | a4db227b4064a01725550953848669b3467ba57f /ui | |
parent | 549c0c1c828f3a00c705c602e4ebb74ac762d37d (diff) | |
download | chromium_src-4a0ae6fde4030129a30d861e69f679f924a7df02.zip chromium_src-4a0ae6fde4030129a30d861e69f679f924a7df02.tar.gz chromium_src-4a0ae6fde4030129a30d861e69f679f924a7df02.tar.bz2 |
Make sure the WebContents has focus after being attached to a WebView, if that WebView was focused.
http://crbug.com/123995
TEST=none. I need to add a set of unit tests to views for WebView, but that requires creating a new exe that can depend on content. I've filed http://crbug.com/124662 for this.
Review URL: https://chromiumcodereview.appspot.com/10186007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133490 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/controls/webview/webview.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc index ad5fc8a..af7803b 100644 --- a/ui/views/controls/webview/webview.cc +++ b/ui/views/controls/webview/webview.cc @@ -180,6 +180,12 @@ void WebView::AttachWebContents() { if (web_contents_) { wcv_holder_->Attach(web_contents_->GetNativeView()); + // The WebContentsView will not be focused automatically when it is + // attached, so we need to pass on focus to it if the FocusManager thinks + // the WebView is focused. + if (GetFocusManager()->GetFocusedView() == this) + web_contents_->Focus(); + registrar_.Add( this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, |