Add a FocusSource parameter to OnSetFocus() that indicates where the focus request is originating from (issue #369).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@306 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-10-07 10:30:10 +00:00
parent 7a3154c9ba
commit 1c2f102bb0
10 changed files with 41 additions and 19 deletions

View File

@@ -971,7 +971,8 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
if (client_.get()) {
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
if (!handler.get() ||
(handler.get() && !handler->OnSetFocus(this, false))) {
(handler.get() &&
!handler->OnSetFocus(this, FOCUS_SOURCE_NAVIGATION))) {
// 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

View File

@@ -89,7 +89,7 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
if (client.get()) {
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
if (handler.get())
handled = handler->OnSetFocus(browser, false);
handled = handler->OnSetFocus(browser, FOCUS_SOURCE_SYSTEM);
}
if (!handled)

View File

@@ -521,7 +521,7 @@ void BrowserWebViewDelegate::didFocus() {
if (client.get()) {
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
if (handler.get())
handled = handler->OnSetFocus(browser_, true);
handled = handler->OnSetFocus(browser_, FOCUS_SOURCE_WIDGET);
}
if (!handled)

View File

@@ -158,8 +158,10 @@
CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) {
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
if (handler.get() && handler->OnSetFocus(browser_, false))
if (handler.get() &&
handler->OnSetFocus(browser_, FOCUS_SOURCE_SYSTEM)) {
return NO;
}
}
browser_->UIT_GetWebViewHost()->SetFocus(YES);