Add CefBrowserHost::WasHidden() method for notifying a windowless browser that it has been hidden or shown (issue #909).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1180 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
ba2fa28c05
commit
67d59cb2b9
|
@ -339,6 +339,13 @@ typedef struct _cef_browser_host_t {
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *was_resized)(struct _cef_browser_host_t* self);
|
void (CEF_CALLBACK *was_resized)(struct _cef_browser_host_t* self);
|
||||||
|
|
||||||
|
///
|
||||||
|
// Notify the browser that it has been hidden or shown. Layouting and
|
||||||
|
// cef_render_handler_t::OnPaint notification will stop when the browser is
|
||||||
|
// hidden. This function is only used when window rendering is disabled.
|
||||||
|
///
|
||||||
|
void (CEF_CALLBACK *was_hidden)(struct _cef_browser_host_t* self, int hidden);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Invalidate the |dirtyRect| region of the view. The browser will call
|
// Invalidate the |dirtyRect| region of the view. The browser will call
|
||||||
// cef_render_handler_t::OnPaint asynchronously with the updated regions. This
|
// cef_render_handler_t::OnPaint asynchronously with the updated regions. This
|
||||||
|
|
|
@ -380,6 +380,14 @@ class CefBrowserHost : public virtual CefBase {
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void WasResized() =0;
|
virtual void WasResized() =0;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Notify the browser that it has been hidden or shown. Layouting and
|
||||||
|
// CefRenderHandler::OnPaint notification will stop when the browser is
|
||||||
|
// hidden. This method is only used when window rendering is disabled.
|
||||||
|
///
|
||||||
|
/*--cef()--*/
|
||||||
|
virtual void WasHidden(bool hidden) =0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Invalidate the |dirtyRect| region of the view. The browser will call
|
// Invalidate the |dirtyRect| region of the view. The browser will call
|
||||||
// CefRenderHandler::OnPaint asynchronously with the updated regions. This
|
// CefRenderHandler::OnPaint asynchronously with the updated regions. This
|
||||||
|
|
|
@ -641,6 +641,32 @@ void CefBrowserHostImpl::WasResized() {
|
||||||
widget->WasResized();
|
widget->WasResized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserHostImpl::WasHidden(bool hidden) {
|
||||||
|
if (!IsWindowRenderingDisabled()) {
|
||||||
|
NOTREACHED() << "Window rendering is not disabled";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||||
|
CEF_POST_TASK(CEF_UIT,
|
||||||
|
base::Bind(&CefBrowserHostImpl::WasHidden, this, hidden));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!web_contents())
|
||||||
|
return;
|
||||||
|
|
||||||
|
content::RenderWidgetHostImpl* widget =
|
||||||
|
content::RenderWidgetHostImpl::From(web_contents()->GetRenderViewHost());
|
||||||
|
if (!widget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (hidden)
|
||||||
|
widget->WasHidden();
|
||||||
|
else
|
||||||
|
widget->WasShown();
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::Invalidate(const CefRect& dirtyRect,
|
void CefBrowserHostImpl::Invalidate(const CefRect& dirtyRect,
|
||||||
PaintElementType type) {
|
PaintElementType type) {
|
||||||
if (!IsWindowRenderingDisabled()) {
|
if (!IsWindowRenderingDisabled()) {
|
||||||
|
@ -848,6 +874,7 @@ void CefBrowserHostImpl::SendFocusEvent(bool setFocus) {
|
||||||
widget->Blur();
|
widget->Blur();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::SendCaptureLostEvent() {
|
void CefBrowserHostImpl::SendCaptureLostEvent() {
|
||||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
|
|
|
@ -129,6 +129,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||||
virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
|
virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
|
||||||
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
||||||
virtual void WasResized() OVERRIDE;
|
virtual void WasResized() OVERRIDE;
|
||||||
|
virtual void WasHidden(bool hidden) OVERRIDE;
|
||||||
virtual void Invalidate(const CefRect& dirtyRect,
|
virtual void Invalidate(const CefRect& dirtyRect,
|
||||||
PaintElementType type) OVERRIDE;
|
PaintElementType type) OVERRIDE;
|
||||||
virtual void SendKeyEvent(const CefKeyEvent& event) OVERRIDE;
|
virtual void SendKeyEvent(const CefKeyEvent& event) OVERRIDE;
|
||||||
|
|
|
@ -335,6 +335,19 @@ void CEF_CALLBACK browser_host_was_resized(struct _cef_browser_host_t* self) {
|
||||||
CefBrowserHostCppToC::Get(self)->WasResized();
|
CefBrowserHostCppToC::Get(self)->WasResized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK browser_host_was_hidden(struct _cef_browser_host_t* self,
|
||||||
|
int hidden) {
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
CefBrowserHostCppToC::Get(self)->WasHidden(
|
||||||
|
hidden?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
void CEF_CALLBACK browser_host_invalidate(struct _cef_browser_host_t* self,
|
void CEF_CALLBACK browser_host_invalidate(struct _cef_browser_host_t* self,
|
||||||
const cef_rect_t* dirtyRect, enum cef_paint_element_type_t type) {
|
const cef_rect_t* dirtyRect, enum cef_paint_element_type_t type) {
|
||||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
@ -504,6 +517,7 @@ CefBrowserHostCppToC::CefBrowserHostCppToC(CefBrowserHost* cls)
|
||||||
struct_.struct_.is_window_rendering_disabled =
|
struct_.struct_.is_window_rendering_disabled =
|
||||||
browser_host_is_window_rendering_disabled;
|
browser_host_is_window_rendering_disabled;
|
||||||
struct_.struct_.was_resized = browser_host_was_resized;
|
struct_.struct_.was_resized = browser_host_was_resized;
|
||||||
|
struct_.struct_.was_hidden = browser_host_was_hidden;
|
||||||
struct_.struct_.invalidate = browser_host_invalidate;
|
struct_.struct_.invalidate = browser_host_invalidate;
|
||||||
struct_.struct_.send_key_event = browser_host_send_key_event;
|
struct_.struct_.send_key_event = browser_host_send_key_event;
|
||||||
struct_.struct_.send_mouse_click_event = browser_host_send_mouse_click_event;
|
struct_.struct_.send_mouse_click_event = browser_host_send_mouse_click_event;
|
||||||
|
|
|
@ -279,6 +279,17 @@ void CefBrowserHostCToCpp::WasResized() {
|
||||||
struct_->was_resized(struct_);
|
struct_->was_resized(struct_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserHostCToCpp::WasHidden(bool hidden) {
|
||||||
|
if (CEF_MEMBER_MISSING(struct_, was_hidden))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||||
|
|
||||||
|
// Execute
|
||||||
|
struct_->was_hidden(struct_,
|
||||||
|
hidden);
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserHostCToCpp::Invalidate(const CefRect& dirtyRect,
|
void CefBrowserHostCToCpp::Invalidate(const CefRect& dirtyRect,
|
||||||
PaintElementType type) {
|
PaintElementType type) {
|
||||||
if (CEF_MEMBER_MISSING(struct_, invalidate))
|
if (CEF_MEMBER_MISSING(struct_, invalidate))
|
||||||
|
|
|
@ -56,6 +56,7 @@ class CefBrowserHostCToCpp
|
||||||
virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
|
virtual bool IsMouseCursorChangeDisabled() OVERRIDE;
|
||||||
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
||||||
virtual void WasResized() OVERRIDE;
|
virtual void WasResized() OVERRIDE;
|
||||||
|
virtual void WasHidden(bool hidden) OVERRIDE;
|
||||||
virtual void Invalidate(const CefRect& dirtyRect,
|
virtual void Invalidate(const CefRect& dirtyRect,
|
||||||
PaintElementType type) OVERRIDE;
|
PaintElementType type) OVERRIDE;
|
||||||
virtual void SendKeyEvent(const CefKeyEvent& event) OVERRIDE;
|
virtual void SendKeyEvent(const CefKeyEvent& event) OVERRIDE;
|
||||||
|
|
Loading…
Reference in New Issue