This commit is contained in:
Heilig Benedek
2016-07-28 01:58:23 +02:00
parent c45d9555e7
commit 0dbe4bc417
7 changed files with 188 additions and 216 deletions

View File

@@ -287,6 +287,9 @@ WebContents::WebContents(v8::Isolate* isolate,
type_ = WEB_VIEW;
else if (options.Get("isBackgroundPage", &b) && b)
type_ = BACKGROUND_PAGE;
bool offscreen = false;
options.Get("offScreen", &offscreen);
// Obtain the session.
std::string partition;
@@ -310,8 +313,8 @@ WebContents::WebContents(v8::Isolate* isolate,
guest_delegate_.reset(new WebViewGuestDelegate);
params.guest_delegate = guest_delegate_.get();
web_contents = content::WebContents::Create(params);
} else {
content::WebContents::CreateParams params(session->browser_context());
} else if(offscreen) {
content::WebContents::CreateParams params(session->browser_context());
auto view = new OffScreenWebContentsView();
params.view = view;
@@ -319,6 +322,9 @@ WebContents::WebContents(v8::Isolate* isolate,
web_contents = content::WebContents::Create(params);
view->SetWebContents(web_contents);
} else {
content::WebContents::CreateParams params(session->browser_context());
web_contents = content::WebContents::Create(params);
}
Observe(web_contents);

View File

@@ -74,14 +74,6 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) {
mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate);
options.Get(options::kWebPreferences, &web_preferences);
bool b;
if (options.Get("disableGPU", &b) && b) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
command_line->AppendSwitch(::switches::kDisableGpu);
command_line->AppendSwitch(::switches::kDisableGpuCompositing);
}
// Copy the backgroundColor to webContents.
v8::Local<v8::Value> value;
if (options.Get(options::kBackgroundColor, &value))

View File

@@ -188,20 +188,12 @@ void CommonWebContentsDelegate::InitWithWebContents(
printing::PrintViewManagerBasic::CreateForWebContents(web_contents);
printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents);
// content::WebContentsImpl* impl =
// reinterpret_cast<content::WebContentsImpl*>(web_contents);
std::cout << "end" << std::endl;
// Create InspectableWebContents.
web_contents_.reset(brightray::InspectableWebContents::Create(web_contents));
web_contents_->SetDelegate(this);
// impl->SetView(new OffScreenWebContentsView);
std::cout << "end" << std::endl;
}
void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
std::cout << "SetOwnerWindow" << std::endl;
SetOwnerWindow(GetWebContents(), owner_window);
}

View File

@@ -344,24 +344,6 @@ NativeWindowViews::~NativeWindowViews() {
window_->RemoveObserver(this);
}
void NativeWindowViews::RenderViewCreated(
content::RenderViewHost* render_view_host) {
std::cout << "NativeWindowViews::RenderViewCreated" << std::endl;
NativeWindow::RenderViewCreated(render_view_host);
content::RenderWidgetHostImpl* impl = content::RenderWidgetHostImpl::FromID(
render_view_host->GetProcess()->GetID(),
render_view_host->GetRoutingID());
if (impl) {
//auto win = new OffScreenWindow(impl);
/*auto view = widget()->GetContentsView();
view->AcquireLayer();
view->SetLayer(win->DelegatedFrameHostGetLayer());
win->DelegatedFrameHostGetLayer()->set_delegate(view);*/
}
}
void NativeWindowViews::Close() {
if (!IsClosable()) {
WindowList::WindowCloseCancelled(this);

View File

@@ -49,7 +49,6 @@ class NativeWindowViews : public NativeWindow,
~NativeWindowViews() override;
// NativeWindow:
void RenderViewCreated(content::RenderViewHost*) override;
void Close() override;
void CloseImmediately() override;
void Focus(bool focus) override;

View File

@@ -25,8 +25,6 @@
#include "ui/gfx/switches.h"
#endif
#include <iostream>
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsPreferences);
namespace atom {