mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefHandler::HandleStatus for status messages, mouse over URLs and keyboard focus URLs (issue #61).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@169 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -843,6 +843,17 @@ public:
|
|||||||
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser,
|
||||||
CefString& text) =0;
|
CefString& text) =0;
|
||||||
|
|
||||||
|
// Status message types.
|
||||||
|
typedef cef_handler_statustype_t StatusType;
|
||||||
|
|
||||||
|
// Event called when the browser has a status message. |text| contains the
|
||||||
|
// text that will be displayed in the status message and |type| indicates the
|
||||||
|
// status message type. The return value is currently ignored.
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual RetVal HandleStatus(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& value,
|
||||||
|
StatusType type) =0;
|
||||||
|
|
||||||
// Called to display a console message. Return RV_HANDLED to stop the message
|
// Called to display a console message. Return RV_HANDLED to stop the message
|
||||||
// from being output to the console.
|
// from being output to the console.
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
|
@ -618,6 +618,13 @@ typedef struct _cef_handler_t
|
|||||||
enum cef_retval_t (CEF_CALLBACK *handle_tooltip)(struct _cef_handler_t* self,
|
enum cef_retval_t (CEF_CALLBACK *handle_tooltip)(struct _cef_handler_t* self,
|
||||||
struct _cef_browser_t* browser, cef_string_t* text);
|
struct _cef_browser_t* browser, cef_string_t* text);
|
||||||
|
|
||||||
|
// Event called when the browser has a status message. |text| contains the
|
||||||
|
// text that will be displayed in the status message and |type| indicates the
|
||||||
|
// status message type. The return value is currently ignored.
|
||||||
|
enum cef_retval_t (CEF_CALLBACK *handle_status)(struct _cef_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, const cef_string_t* value,
|
||||||
|
enum cef_handler_statustype_t type);
|
||||||
|
|
||||||
// Called to display a console message. Return RV_HANDLED to stop the message
|
// Called to display a console message. Return RV_HANDLED to stop the message
|
||||||
// from being output to the console.
|
// from being output to the console.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_console_message)(
|
enum cef_retval_t (CEF_CALLBACK *handle_console_message)(
|
||||||
|
@ -515,6 +515,14 @@ enum cef_xml_node_type_t
|
|||||||
XML_NODE_COMMENT,
|
XML_NODE_COMMENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Status message types.
|
||||||
|
enum cef_handler_statustype_t
|
||||||
|
{
|
||||||
|
STATUSTYPE_TEXT = 0,
|
||||||
|
STATUSTYPE_MOUSEOVER_URL,
|
||||||
|
STATUSTYPE_KEYBOARD_FOCUS_URL,
|
||||||
|
};
|
||||||
|
|
||||||
// Popup window features.
|
// Popup window features.
|
||||||
typedef struct _cef_popup_features_t
|
typedef struct _cef_popup_features_t
|
||||||
{
|
{
|
||||||
|
@ -389,12 +389,15 @@ bool BrowserWebViewDelegate::runModalBeforeUnloadDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::setStatusText(const WebString& text) {
|
void BrowserWebViewDelegate::setStatusText(const WebString& text) {
|
||||||
|
ShowStatus(text, STATUSTYPE_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::setMouseOverURL(const WebURL& url) {
|
void BrowserWebViewDelegate::setMouseOverURL(const WebURL& url) {
|
||||||
|
ShowStatus(url.spec().utf16(), STATUSTYPE_MOUSEOVER_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::setKeyboardFocusURL(const WebKit::WebURL& url) {
|
void BrowserWebViewDelegate::setKeyboardFocusURL(const WebKit::WebURL& url) {
|
||||||
|
ShowStatus(url.spec().utf16(), STATUSTYPE_KEYBOARD_FOCUS_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::setToolTipText(
|
void BrowserWebViewDelegate::setToolTipText(
|
||||||
@ -891,6 +894,16 @@ void BrowserWebViewDelegate::WaitForPolicyDelegate() {
|
|||||||
|
|
||||||
// Private methods -----------------------------------------------------------
|
// Private methods -----------------------------------------------------------
|
||||||
|
|
||||||
|
void BrowserWebViewDelegate::ShowStatus(const WebString& text,
|
||||||
|
CefHandler::StatusType type)
|
||||||
|
{
|
||||||
|
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||||
|
if(handler.get()) {
|
||||||
|
CefString textStr = string16(text);
|
||||||
|
handler->HandleStatus(browser_, textStr, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||||
bool is_top_frame = false;
|
bool is_top_frame = false;
|
||||||
|
@ -262,6 +262,9 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||||||
const WebKit::WebString& title,
|
const WebKit::WebString& title,
|
||||||
const FilePath& default_file);
|
const FilePath& default_file);
|
||||||
|
|
||||||
|
// Called to show status messages.
|
||||||
|
void ShowStatus(const WebKit::WebString& text, CefHandler::StatusType type);
|
||||||
|
|
||||||
// In the Mac code, this is called to trigger the end of a test after the
|
// In the Mac code, this is called to trigger the end of a test after the
|
||||||
// page has finished loading. From here, we can generate the dump for the
|
// page has finished loading. From here, we can generate the dump for the
|
||||||
// test.
|
// test.
|
||||||
|
@ -503,6 +503,19 @@ enum cef_retval_t CEF_CALLBACK handler_handle_tooltip(
|
|||||||
CefBrowserCToCpp::Wrap(browser), textStr);
|
CefBrowserCToCpp::Wrap(browser), textStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum cef_retval_t CEF_CALLBACK handler_handle_status(
|
||||||
|
struct _cef_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* value, enum cef_handler_statustype_t type)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if(!self || !browser)
|
||||||
|
return RV_CONTINUE;
|
||||||
|
|
||||||
|
return CefHandlerCppToC::Get(self)->HandleStatus(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefString(value), type);
|
||||||
|
}
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_console_message(
|
enum cef_retval_t CEF_CALLBACK handler_handle_console_message(
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
struct _cef_handler_t* self, cef_browser_t* browser,
|
||||||
const cef_string_t* message, const cef_string_t* source, int line)
|
const cef_string_t* message, const cef_string_t* source, int line)
|
||||||
@ -569,6 +582,7 @@ CefHandlerCppToC::CefHandlerCppToC(CefHandler* cls)
|
|||||||
struct_.struct_.handle_set_focus = handler_handle_set_focus;
|
struct_.struct_.handle_set_focus = handler_handle_set_focus;
|
||||||
struct_.struct_.handle_key_event = handler_handle_key_event;
|
struct_.struct_.handle_key_event = handler_handle_key_event;
|
||||||
struct_.struct_.handle_tooltip = handler_handle_tooltip;
|
struct_.struct_.handle_tooltip = handler_handle_tooltip;
|
||||||
|
struct_.struct_.handle_status = handler_handle_status;
|
||||||
struct_.struct_.handle_console_message = handler_handle_console_message;
|
struct_.struct_.handle_console_message = handler_handle_console_message;
|
||||||
struct_.struct_.handle_find_result = handler_handle_find_result;
|
struct_.struct_.handle_find_result = handler_handle_find_result;
|
||||||
}
|
}
|
||||||
|
@ -371,6 +371,16 @@ CefHandler::RetVal CefHandlerCToCpp::HandleTooltip(
|
|||||||
CefBrowserCppToC::Wrap(browser), text.GetWritableStruct());
|
CefBrowserCppToC::Wrap(browser), text.GetWritableStruct());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefHandler::RetVal CefHandlerCToCpp::HandleStatus(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& value, StatusType type)
|
||||||
|
{
|
||||||
|
if(CEF_MEMBER_MISSING(struct_, handle_status))
|
||||||
|
return RV_CONTINUE;
|
||||||
|
|
||||||
|
return struct_->handle_status(struct_,
|
||||||
|
CefBrowserCppToC::Wrap(browser), value.GetStruct(), type);
|
||||||
|
}
|
||||||
|
|
||||||
CefHandler::RetVal CefHandlerCToCpp::HandleConsoleMessage(
|
CefHandler::RetVal CefHandlerCToCpp::HandleConsoleMessage(
|
||||||
CefRefPtr<CefBrowser> browser, const CefString& message,
|
CefRefPtr<CefBrowser> browser, const CefString& message,
|
||||||
const CefString& source, int line)
|
const CefString& source, int line)
|
||||||
|
@ -89,6 +89,8 @@ public:
|
|||||||
virtual RetVal HandleKeyEvent(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||||
KeyEventType type, int code, int modifiers, bool isSystemKey);
|
KeyEventType type, int code, int modifiers, bool isSystemKey);
|
||||||
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser, CefString& text);
|
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser, CefString& text);
|
||||||
|
virtual RetVal HandleStatus(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& value, StatusType type);
|
||||||
virtual RetVal HandleConsoleMessage(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& message, const CefString& source, int line);
|
const CefString& message, const CefString& source, int line);
|
||||||
virtual RetVal HandleFindResult(CefRefPtr<CefBrowser> browser, int identifier,
|
virtual RetVal HandleFindResult(CefRefPtr<CefBrowser> browser, int identifier,
|
||||||
|
@ -291,6 +291,16 @@ public:
|
|||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Event called when the browser has a status message. |text| contains the
|
||||||
|
// text that will be displayed in the status message and |type| indicates the
|
||||||
|
// status message type. The return value is currently ignored.
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual RetVal HandleStatus(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& text, StatusType type)
|
||||||
|
{
|
||||||
|
return RV_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Called when the browser component receives a keyboard event.
|
// Called when the browser component receives a keyboard event.
|
||||||
// |type| is the type of keyboard event (see |KeyEventType|).
|
// |type| is the type of keyboard event (see |KeyEventType|).
|
||||||
// |code| is the windows scan-code for the event.
|
// |code| is the windows scan-code for the event.
|
||||||
|
@ -253,6 +253,12 @@ public:
|
|||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual RetVal HandleStatus(CefRefPtr<CefBrowser> browser,
|
||||||
|
const CefString& text, StatusType type)
|
||||||
|
{
|
||||||
|
return RV_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
virtual RetVal HandleConsoleMessage(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& message,
|
const CefString& message,
|
||||||
const CefString& source, int line)
|
const CefString& source, int line)
|
||||||
|
Reference in New Issue
Block a user