Move RenderViewCreated logic to api::BrowserWindow

This commit is contained in:
Cheng Zhao 2018-02-22 15:04:32 +09:00
parent c256a43139
commit 6650a06339
4 changed files with 15 additions and 14 deletions

View file

@ -20,7 +20,9 @@
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/content_switches.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
@ -177,6 +179,18 @@ BrowserWindow::~BrowserWindow() {
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, window_.release());
}
void BrowserWindow::RenderViewCreated(
content::RenderViewHost* render_view_host) {
if (!window_->transparent())
return;
content::RenderWidgetHostImpl* impl = content::RenderWidgetHostImpl::FromID(
render_view_host->GetProcess()->GetID(),
render_view_host->GetRoutingID());
if (impl)
impl->SetBackgroundOpaque(false);
}
void BrowserWindow::DidFirstVisuallyNonEmptyPaint() {
if (window_->IsVisible())
return;

View file

@ -62,6 +62,7 @@ class BrowserWindow : public mate::TrackableObject<BrowserWindow>,
~BrowserWindow() override;
// content::WebContentsObserver:
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void DidFirstVisuallyNonEmptyPaint() override;
// NativeWindowObserver:

View file

@ -24,7 +24,6 @@
#include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "components/prefs/pref_service.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/render_process_host.h"
@ -653,18 +652,6 @@ std::unique_ptr<SkRegion> NativeWindow::DraggableRegionsToSkRegion(
return sk_region;
}
void NativeWindow::RenderViewCreated(
content::RenderViewHost* render_view_host) {
if (!transparent_)
return;
content::RenderWidgetHostImpl* impl = content::RenderWidgetHostImpl::FromID(
render_view_host->GetProcess()->GetID(),
render_view_host->GetRoutingID());
if (impl)
impl->SetBackgroundOpaque(false);
}
void NativeWindow::BeforeUnloadDialogCancelled() {
WindowList::WindowCloseCancelled(this);

View file

@ -318,7 +318,6 @@ class NativeWindow : public base::SupportsUserData,
const std::vector<DraggableRegion>& regions);
// content::WebContentsObserver:
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void BeforeUnloadDialogCancelled() override;
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* rfh) override;