Fix OSR popup transparency (issue #2099)

This commit is contained in:
Marshall Greenblatt 2017-02-15 16:03:00 -05:00
parent 897c0f01ed
commit c82ef82c21
3 changed files with 8 additions and 3 deletions

View File

@ -40,7 +40,7 @@ void CefBrowserPlatformDelegateOsr::WebContentsCreated(
DCHECK(!view_osr_->web_contents()); DCHECK(!view_osr_->web_contents());
// Associate the WebContents with the OSR view. // Associate the WebContents with the OSR view.
view_osr_->set_web_contents(web_contents); view_osr_->WebContentsCreated(web_contents);
} }
void CefBrowserPlatformDelegateOsr::BrowserCreated( void CefBrowserPlatformDelegateOsr::BrowserCreated(

View File

@ -24,10 +24,13 @@ CefWebContentsViewOSR::CefWebContentsViewOSR(bool transparent)
CefWebContentsViewOSR::~CefWebContentsViewOSR() { CefWebContentsViewOSR::~CefWebContentsViewOSR() {
} }
void CefWebContentsViewOSR::set_web_contents( void CefWebContentsViewOSR::WebContentsCreated(
content::WebContents* web_contents) { content::WebContents* web_contents) {
DCHECK(!web_contents_); DCHECK(!web_contents_);
web_contents_ = web_contents; web_contents_ = web_contents;
// Call this again for popup browsers now that the view should exist.
RenderViewCreated(web_contents_->GetRenderViewHost());
} }
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const { gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
@ -114,6 +117,8 @@ void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {
} }
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) { void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
// |view| will be nullptr the first time this method is called for popup
// browsers.
CefRenderWidgetHostViewOSR* view = GetView(); CefRenderWidgetHostViewOSR* view = GetView();
if (view) if (view)
view->InstallTransparency(); view->InstallTransparency();

View File

@ -25,7 +25,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
explicit CefWebContentsViewOSR(bool transparent); explicit CefWebContentsViewOSR(bool transparent);
~CefWebContentsViewOSR() override; ~CefWebContentsViewOSR() override;
void set_web_contents(content::WebContents* web_contents); void WebContentsCreated(content::WebContents* web_contents);
content::WebContents* web_contents() const { return web_contents_; } content::WebContents* web_contents() const { return web_contents_; }
// WebContentsView methods. // WebContentsView methods.