std::unique_ptr<WebContents>

This commit is contained in:
Jeremy Apthorp 2018-09-14 17:16:22 -07:00 committed by Aleksei Kuzmin
parent 8060e915c2
commit a5b09e25ea
4 changed files with 24 additions and 19 deletions

View file

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

View file

@ -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,