refactor: WebContents::From returns pointer (#24605)

This commit is contained in:
Jeremy Rose 2020-07-16 16:16:05 -07:00 committed by GitHub
parent 14bbc07f1e
commit 45551f6bf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 63 deletions

View file

@ -143,10 +143,9 @@ void ToDictionary(gin::Dictionary* details, extensions::WebRequestInfo* info) {
auto* web_contents = content::WebContents::FromRenderFrameHost(
content::RenderFrameHost::FromID(info->render_process_id,
info->frame_id));
int32_t id = api::WebContents::GetIDFromWrappedClass(web_contents);
// id must be greater than zero.
if (id > 0)
details->Set("webContentsId", id);
auto* api_web_contents = WebContents::From(web_contents);
if (api_web_contents)
details->Set("webContentsId", api_web_contents->ID());
}
void ToDictionary(gin::Dictionary* details,