diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index bc5aba2f36b6..e3b86572d9f4 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -384,15 +384,11 @@ void WebContents::RenderViewReady() { // WebContents::GetRenderWidgetHostView will return the RWHV of an // interstitial page if one is showing at this time. We only want opacity // to apply to web pages. - if (guest_opaque_) { - web_contents() - ->GetRenderViewHost() - ->GetView() - ->SetBackgroundColorToDefault(); - } else { - web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor( - SK_ColorTRANSPARENT); - } + auto render_view_host_view = web_contents()->GetRenderViewHost()->GetView(); + if (guest_opaque_) + render_view_host_view->SetBackgroundColorToDefault(); + else + render_view_host_view->SetBackgroundColor(SK_ColorTRANSPARENT); } void WebContents::WebContentsDestroyed() { @@ -669,6 +665,10 @@ void WebContents::SetAllowTransparency(bool allow) { } } +bool WebContents::IsGuest() const { + return is_guest(); +} + void WebContents::HasServiceWorker( const base::Callback& callback) { auto context = GetServiceWorkerContext(web_contents()); @@ -740,7 +740,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( .SetMethod("_send", &WebContents::SendIPCMessage) .SetMethod("setSize", &WebContents::SetSize) .SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency) - .SetMethod("isGuest", &WebContents::is_guest) + .SetMethod("isGuest", &WebContents::IsGuest) .SetMethod("hasServiceWorker", &WebContents::HasServiceWorker) .SetMethod("unregisterServiceWorker", &WebContents::UnregisterServiceWorker) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 42ce299a4621..278426e73599 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -108,8 +108,7 @@ class WebContents : public mate::EventEmitter, // Sets the transparency of the guest. void SetAllowTransparency(bool allow); - // Returns whether this is a guest view. - bool is_guest() const { return guest_instance_id_ != -1; } + bool IsGuest() const; // Returns whether this guest has an associated embedder. bool attached() const { return !!embedder_web_contents_; }