|
@@ -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())) {
|