clang-format atom_api_web_contents.cc

This commit is contained in:
Jeremy Apthorp 2018-05-10 13:52:42 -07:00
parent 87d0175c76
commit 72057bf7ef

View file

@ -854,9 +854,7 @@ void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host,
bool is_main_frame = !render_frame_host->GetParent(); bool is_main_frame = !render_frame_host->GetParent();
int frame_process_id = render_frame_host->GetProcess()->GetID(); int frame_process_id = render_frame_host->GetProcess()->GetID();
int frame_routing_id = render_frame_host->GetRoutingID(); int frame_routing_id = render_frame_host->GetRoutingID();
Emit("did-frame-finish-load", Emit("did-frame-finish-load", is_main_frame, frame_process_id,
is_main_frame,
frame_process_id,
frame_routing_id); frame_routing_id);
if (is_main_frame) if (is_main_frame)
@ -870,13 +868,8 @@ void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
bool is_main_frame = !render_frame_host->GetParent(); bool is_main_frame = !render_frame_host->GetParent();
int frame_process_id = render_frame_host->GetProcess()->GetID(); int frame_process_id = render_frame_host->GetProcess()->GetID();
int frame_routing_id = render_frame_host->GetRoutingID(); int frame_routing_id = render_frame_host->GetRoutingID();
Emit("did-fail-load", Emit("did-fail-load", error_code, error_description, url, is_main_frame,
error_code, frame_process_id, frame_routing_id);
error_description,
url,
is_main_frame,
frame_process_id,
frame_routing_id);
} }
void WebContents::DidStartLoading() { void WebContents::DidStartLoading() {
@ -932,12 +925,8 @@ void WebContents::DidStartNavigation(
} }
bool is_same_document = navigation_handle->IsSameDocument(); bool is_same_document = navigation_handle->IsSameDocument();
auto url = navigation_handle->GetURL(); auto url = navigation_handle->GetURL();
Emit("did-start-navigation", Emit("did-start-navigation", url, is_same_document, is_main_frame,
url, frame_process_id, frame_routing_id);
is_same_document,
is_main_frame,
frame_process_id,
frame_routing_id);
} }
void WebContents::DidFinishNavigation( void WebContents::DidFinishNavigation(
@ -956,27 +945,19 @@ void WebContents::DidFinishNavigation(
auto url = navigation_handle->GetURL(); auto url = navigation_handle->GetURL();
bool is_same_document = navigation_handle->IsSameDocument(); bool is_same_document = navigation_handle->IsSameDocument();
if (is_same_document) { if (is_same_document) {
Emit("did-navigate-in-page", Emit("did-navigate-in-page", url, is_main_frame, frame_process_id,
url,
is_main_frame,
frame_process_id,
frame_routing_id); frame_routing_id);
} else { } else {
const net::HttpResponseHeaders* http_response const net::HttpResponseHeaders* http_response =
= navigation_handle->GetResponseHeaders(); navigation_handle->GetResponseHeaders();
std::string http_status_text; std::string http_status_text;
int http_response_code = -1; int http_response_code = -1;
if (http_response) { if (http_response) {
http_status_text = http_response->GetStatusText(); http_status_text = http_response->GetStatusText();
http_response_code = http_response->response_code(); http_response_code = http_response->response_code();
} }
Emit("did-frame-navigate", Emit("did-frame-navigate", url, http_response_code, http_status_text,
url, is_main_frame, frame_process_id, frame_routing_id);
http_response_code,
http_status_text,
is_main_frame,
frame_process_id,
frame_routing_id);
if (is_main_frame) { if (is_main_frame) {
Emit("did-navigate", url, http_response_code, http_status_text); Emit("did-navigate", url, http_response_code, http_status_text);
} }
@ -985,23 +966,13 @@ void WebContents::DidFinishNavigation(
auto url = navigation_handle->GetURL(); auto url = navigation_handle->GetURL();
int code = navigation_handle->GetNetErrorCode(); int code = navigation_handle->GetNetErrorCode();
auto description = net::ErrorToShortString(code); auto description = net::ErrorToShortString(code);
Emit("did-fail-provisional-load", Emit("did-fail-provisional-load", code, description, url, is_main_frame,
code, frame_process_id, frame_routing_id);
description,
url,
is_main_frame,
frame_process_id,
frame_routing_id);
// Do not emit "did-fail-load" for canceled requests. // Do not emit "did-fail-load" for canceled requests.
if (code != net::ERR_ABORTED) if (code != net::ERR_ABORTED)
Emit("did-fail-load", Emit("did-fail-load", code, description, url, is_main_frame,
code, frame_process_id, frame_routing_id);
description,
url,
is_main_frame,
frame_process_id,
frame_routing_id);
} }
} }