This commit is contained in:
Jeremy Apthorp 2018-09-14 17:16:22 -07:00 коммит произвёл Aleksei Kuzmin
Родитель 8060e915c2
Коммит a5b09e25ea
4 изменённых файлов: 24 добавлений и 19 удалений

Просмотреть файл

@ -362,7 +362,7 @@ WebContents::WebContents(v8::Isolate* isolate,
}
session_.Reset(isolate, session.ToV8());
content::WebContents* web_contents;
std::unique_ptr<content::WebContents> web_contents;
if (IsGuest()) {
scoped_refptr<content::SiteInstance> site_instance =
content::SiteInstance::CreateForURL(session->browser_context(),
@ -405,7 +405,7 @@ WebContents::WebContents(v8::Isolate* isolate,
web_contents = content::WebContents::Create(params);
}
InitWithSessionAndOptions(isolate, web_contents, session, options);
InitWithSessionAndOptions(isolate, web_contents.release(), session, options);
}
void WebContents::InitZoomController(content::WebContents* web_contents,
@ -537,16 +537,17 @@ void WebContents::WebContentsCreated(content::WebContents* source_contents,
Emit("-web-contents-created", api_web_contents, target_url, frame_name);
}
void WebContents::AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) {
new ChildWebContentsTracker(new_contents);
void WebContents::AddNewContents(
content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) {
new ChildWebContentsTracker(new_contents.get());
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
auto api_web_contents = CreateFrom(isolate(), new_contents);
auto api_web_contents = CreateFrom(isolate(), new_contents.release());
if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture,
initial_rect.x(), initial_rect.y(), initial_rect.width(),
initial_rect.height())) {

Просмотреть файл

@ -300,7 +300,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
const GURL& target_url,
content::WebContents* new_contents) override;
void AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
std::unique_ptr<content::WebContents> new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,

Просмотреть файл

@ -4,6 +4,8 @@
#include "atom/browser/web_view_guest_delegate.h"
#include <memory>
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "content/browser/web_contents/web_contents_impl.h"
@ -104,13 +106,16 @@ content::WebContents* WebViewGuestDelegate::CreateNewGuestWindow(
guest_params.initial_size =
embedder_web_contents_->GetContainerBounds().size();
guest_params.context = embedder_web_contents_->GetNativeView();
auto* guest_contents = content::WebContents::Create(guest_params);
std::unique_ptr<content::WebContents> guest_contents =
content::WebContents::Create(guest_params);
content::RenderWidgetHost* render_widget_host =
guest_contents->GetRenderViewHost()->GetWidget();
auto* guest_contents_impl =
static_cast<content::WebContentsImpl*>(guest_contents);
guest_contents_impl->GetView()->CreateViewForWidget(
guest_contents->GetRenderViewHost()->GetWidget(), false);
static_cast<content::WebContentsImpl*>(guest_contents.release());
guest_contents_impl->GetView()->CreateViewForWidget(render_widget_host,
false);
return guest_contents;
return guest_contents_impl;
}
} // namespace atom

Просмотреть файл

@ -320,9 +320,8 @@ void InspectableWebContentsImpl::ShowDevTools() {
DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(this));
if (!external_devtools_web_contents_) { // no external devtools
managed_devtools_web_contents_.reset(
content::WebContents::Create(content::WebContents::CreateParams(
web_contents_->GetBrowserContext())));
managed_devtools_web_contents_ = content::WebContents::Create(
content::WebContents::CreateParams(web_contents_->GetBrowserContext()));
managed_devtools_web_contents_->SetDelegate(this);
}