Fix delivery of focus/blur events (issue #1301).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1717 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-06-06 19:04:21 +00:00
parent 99faa3fda4
commit 62d9365b51
17 changed files with 314 additions and 67 deletions

View File

@ -632,11 +632,29 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) {
}
}
void CefBrowserHostImpl::SetFocus(bool enable) {
if (!enable)
return;
void CefBrowserHostImpl::SetFocus(bool focus) {
if (focus) {
OnSetFocus(FOCUS_SOURCE_SYSTEM);
} else {
if (CEF_CURRENTLY_ON_UIT()) {
PlatformSetFocus(false);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::PlatformSetFocus, this, false));
}
}
}
OnSetFocus(FOCUS_SOURCE_SYSTEM);
void CefBrowserHostImpl::SetWindowVisibility(bool visible) {
#if defined(OS_MACOSX)
if (CEF_CURRENTLY_ON_UIT()) {
PlatformSetWindowVisibility(visible);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::PlatformSetWindowVisibility,
this, visible));
}
#endif
}
CefWindowHandle CefBrowserHostImpl::GetWindowHandle() {
@ -1499,15 +1517,7 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
}
}
if (web_contents_.get())
web_contents_->Focus();
#if defined(OS_WIN)
// When windowed rendering is used in combination with Aura on Windows we
// need to explicitly set focus to the native window handle. Otherwise,
// the window doesn't get keyboard focus.
PlatformSetViewFocus();
#endif // defined(OS_WIN)
PlatformSetFocus(true);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source));