Implement CefDisplayHandler OnStatusMessage and OnConsoleMessage callbacks (issue #662).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@772 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
6834d879d3
commit
0d086ee6fb
|
@ -91,8 +91,7 @@ typedef struct _cef_display_handler_t {
|
||||||
// status message type.
|
// status message type.
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *on_status_message)(struct _cef_display_handler_t* self,
|
void (CEF_CALLBACK *on_status_message)(struct _cef_display_handler_t* self,
|
||||||
struct _cef_browser_t* browser, const cef_string_t* value,
|
struct _cef_browser_t* browser, const cef_string_t* value);
|
||||||
enum cef_handler_statustype_t type);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to display a console message. Return true (1) to stop the message
|
// Called to display a console message. Return true (1) to stop the message
|
||||||
|
|
|
@ -49,8 +49,6 @@
|
||||||
/*--cef(source=client)--*/
|
/*--cef(source=client)--*/
|
||||||
class CefDisplayHandler : public virtual CefBase {
|
class CefDisplayHandler : public virtual CefBase {
|
||||||
public:
|
public:
|
||||||
typedef cef_handler_statustype_t StatusType;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called when the loading state has changed.
|
// Called when the loading state has changed.
|
||||||
///
|
///
|
||||||
|
@ -92,8 +90,7 @@ class CefDisplayHandler : public virtual CefBase {
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=value)--*/
|
/*--cef(optional_param=value)--*/
|
||||||
virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser,
|
virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& value,
|
const CefString& value) {}
|
||||||
StatusType type) {}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to display a console message. Return true to stop the message from
|
// Called to display a console message. Return true to stop the message from
|
||||||
|
|
|
@ -1199,15 +1199,6 @@ 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.
|
||||||
///
|
///
|
||||||
|
|
|
@ -908,6 +908,30 @@ void CefBrowserHostImpl::CloseContents(content::WebContents* source) {
|
||||||
PlatformCloseWindow();
|
PlatformCloseWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
|
||||||
|
int32 page_id,
|
||||||
|
const GURL& url) {
|
||||||
|
if (client_.get()) {
|
||||||
|
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||||
|
if (handler.get())
|
||||||
|
handler->OnStatusMessage(this, url.spec());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefBrowserHostImpl::AddMessageToConsole(content::WebContents* source,
|
||||||
|
int32 level,
|
||||||
|
const string16& message,
|
||||||
|
int32 line_no,
|
||||||
|
const string16& source_id) {
|
||||||
|
if (client_.get()) {
|
||||||
|
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||||
|
if (handler.get())
|
||||||
|
return handler->OnConsoleMessage(this, message, source_id, line_no);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CefBrowserHostImpl::TakeFocus(content::WebContents* source,
|
bool CefBrowserHostImpl::TakeFocus(content::WebContents* source,
|
||||||
bool reverse) {
|
bool reverse) {
|
||||||
if (client_.get()) {
|
if (client_.get()) {
|
||||||
|
@ -1567,4 +1591,3 @@ void CefBrowserHostImpl::OnLoadEnd(CefRefPtr<CefFrame> frame,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||||
const content::OpenURLParams& params) OVERRIDE;
|
const content::OpenURLParams& params) OVERRIDE;
|
||||||
virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE;
|
virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE;
|
||||||
virtual void CloseContents(content::WebContents* source) OVERRIDE;
|
virtual void CloseContents(content::WebContents* source) OVERRIDE;
|
||||||
|
virtual void UpdateTargetURL(content::WebContents* source,
|
||||||
|
int32 page_id,
|
||||||
|
const GURL& url) OVERRIDE;
|
||||||
|
virtual bool AddMessageToConsole(content::WebContents* source,
|
||||||
|
int32 level,
|
||||||
|
const string16& message,
|
||||||
|
int32 line_no,
|
||||||
|
const string16& source_id) OVERRIDE;
|
||||||
virtual bool TakeFocus(content::WebContents* source,
|
virtual bool TakeFocus(content::WebContents* source,
|
||||||
bool reverse) OVERRIDE;
|
bool reverse) OVERRIDE;
|
||||||
virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
|
virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
|
||||||
|
|
|
@ -113,7 +113,7 @@ int CEF_CALLBACK display_handler_on_tooltip(struct _cef_display_handler_t* self,
|
||||||
|
|
||||||
void CEF_CALLBACK display_handler_on_status_message(
|
void CEF_CALLBACK display_handler_on_status_message(
|
||||||
struct _cef_display_handler_t* self, cef_browser_t* browser,
|
struct _cef_display_handler_t* self, cef_browser_t* browser,
|
||||||
const cef_string_t* value, enum cef_handler_statustype_t type) {
|
const cef_string_t* value) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
DCHECK(self);
|
DCHECK(self);
|
||||||
|
@ -128,8 +128,7 @@ void CEF_CALLBACK display_handler_on_status_message(
|
||||||
// Execute
|
// Execute
|
||||||
CefDisplayHandlerCppToC::Get(self)->OnStatusMessage(
|
CefDisplayHandlerCppToC::Get(self)->OnStatusMessage(
|
||||||
CefBrowserCToCpp::Wrap(browser),
|
CefBrowserCToCpp::Wrap(browser),
|
||||||
CefString(value),
|
CefString(value));
|
||||||
type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEF_CALLBACK display_handler_on_console_message(
|
int CEF_CALLBACK display_handler_on_console_message(
|
||||||
|
|
|
@ -107,7 +107,7 @@ bool CefDisplayHandlerCToCpp::OnTooltip(CefRefPtr<CefBrowser> browser,
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDisplayHandlerCToCpp::OnStatusMessage(CefRefPtr<CefBrowser> browser,
|
void CefDisplayHandlerCToCpp::OnStatusMessage(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& value, StatusType type) {
|
const CefString& value) {
|
||||||
if (CEF_MEMBER_MISSING(struct_, on_status_message))
|
if (CEF_MEMBER_MISSING(struct_, on_status_message))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -122,8 +122,7 @@ void CefDisplayHandlerCToCpp::OnStatusMessage(CefRefPtr<CefBrowser> browser,
|
||||||
// Execute
|
// Execute
|
||||||
struct_->on_status_message(struct_,
|
struct_->on_status_message(struct_,
|
||||||
CefBrowserCppToC::Wrap(browser),
|
CefBrowserCppToC::Wrap(browser),
|
||||||
value.GetStruct(),
|
value.GetStruct());
|
||||||
type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefDisplayHandlerCToCpp::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
bool CefDisplayHandlerCToCpp::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||||
|
|
|
@ -43,7 +43,7 @@ class CefDisplayHandlerCToCpp
|
||||||
virtual bool OnTooltip(CefRefPtr<CefBrowser> browser,
|
virtual bool OnTooltip(CefRefPtr<CefBrowser> browser,
|
||||||
CefString& text) OVERRIDE;
|
CefString& text) OVERRIDE;
|
||||||
virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser,
|
virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& value, StatusType type) OVERRIDE;
|
const CefString& value) OVERRIDE;
|
||||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||||
const CefString& message, const CefString& source, int line) OVERRIDE;
|
const CefString& message, const CefString& source, int line) OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue