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

@@ -1311,6 +1311,8 @@ public:
class CefFocusHandler : public virtual CefBase
{
public:
typedef cef_handler_focus_source_t FocusSource;
///
// Called when the browser component is about to loose focus. For instance, if
// focus was on the last HTML element and the user pressed the TAB key. |next|
@@ -1322,14 +1324,13 @@ public:
bool next) {}
///
// Called when the browser component is requesting focus. |isWidget| will be
// true if the focus is requested for a child widget of the browser window.
// Return false to allow the focus to be set or true to cancel setting the
// focus.
// Called when the browser component is requesting focus. |source| indicates
// where the focus request is originating from. Return false to allow the
// focus to be set or true to cancel setting the focus.
///
/*--cef()--*/
virtual bool OnSetFocus(CefRefPtr<CefBrowser> browser,
bool isWidget) { return false; }
FocusSource source) { return false; }
};

View File

@@ -1131,13 +1131,12 @@ typedef struct _cef_focus_handler_t
struct _cef_browser_t* browser, int next);
///
// Called when the browser component is requesting focus. |isWidget| will be
// true (1) if the focus is requested for a child widget of the browser
// window. Return false (0) to allow the focus to be set or true (1) to cancel
// setting the focus.
// Called when the browser component is requesting focus. |source| indicates
// where the focus request is originating from. Return false (0) to allow the
// focus to be set or true (1) to cancel setting the focus.
///
int (CEF_CALLBACK *on_set_focus)(struct _cef_focus_handler_t* self,
struct _cef_browser_t* browser, int isWidget);
struct _cef_browser_t* browser, enum cef_handler_focus_source_t source);
} cef_focus_handler_t;

View File

@@ -777,6 +777,25 @@ enum cef_weburlrequest_state_t
WUR_STATE_ABORT = 6,
};
///
// Focus sources.
///
enum cef_handler_focus_source_t
{
///
// The source is explicit navigation via the API (LoadURL(), etc).
///
FOCUS_SOURCE_NAVIGATION = 0,
///
// The source is a system-generated focus event.
///
FOCUS_SOURCE_SYSTEM,
///
// The source is a child widget of the browser window requesting focus.
///
FOCUS_SOURCE_WIDGET,
};
///
// Key event types.
///