mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add a CefHandler::HandleSetFocus() callback that gets called when the browser control or a child widget requests focus. This callback gives the client an opportunity to cancel the focus change. (Issue #34, initial patch by tux316).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@29 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -548,13 +548,19 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
||||
// In case LoadRequest failed before DidCreateDataSource was called.
|
||||
delegate_->set_pending_extra_data(NULL);
|
||||
|
||||
// Restore focus to the main frame prior to loading new request.
|
||||
// This makes sure that we don't have a focused iframe. Otherwise, that
|
||||
// iframe would keep focus when the SetFocus called immediately after
|
||||
// LoadRequest, thus making some tests fail (see http://b/issue?id=845337
|
||||
// for more details).
|
||||
GetWebView()->SetFocusedFrame(frame);
|
||||
UIT_SetFocus(GetWebViewHost(), true);
|
||||
if (handler_.get() && handler_->HandleSetFocus(this, false) == RV_CONTINUE) {
|
||||
// Restore focus to the main frame prior to loading new request.
|
||||
// This makes sure that we don't have a focused iframe. Otherwise, that
|
||||
// iframe would keep focus when the SetFocus called immediately after
|
||||
// LoadRequest, thus making some tests fail (see http://b/issue?id=845337
|
||||
// for more details).
|
||||
// TODO(cef): The above comment may be wrong, or the below call to
|
||||
// SetFocusedFrame() may be unnecessary or in the wrong place. See this
|
||||
// thread for additional details:
|
||||
// http://groups.google.com/group/chromium-dev/browse_thread/thread/42bcd31b59e3a168
|
||||
GetWebView()->SetFocusedFrame(frame);
|
||||
UIT_SetFocus(GetWebViewHost(), true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user