clang-format atom_api_web_contents.cc
This commit is contained in:
parent
87d0175c76
commit
72057bf7ef
1 changed files with 18 additions and 47 deletions
|
@ -854,9 +854,7 @@ void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
|||
bool is_main_frame = !render_frame_host->GetParent();
|
||||
int frame_process_id = render_frame_host->GetProcess()->GetID();
|
||||
int frame_routing_id = render_frame_host->GetRoutingID();
|
||||
Emit("did-frame-finish-load",
|
||||
is_main_frame,
|
||||
frame_process_id,
|
||||
Emit("did-frame-finish-load", is_main_frame, frame_process_id,
|
||||
frame_routing_id);
|
||||
|
||||
if (is_main_frame)
|
||||
|
@ -870,13 +868,8 @@ void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
|
|||
bool is_main_frame = !render_frame_host->GetParent();
|
||||
int frame_process_id = render_frame_host->GetProcess()->GetID();
|
||||
int frame_routing_id = render_frame_host->GetRoutingID();
|
||||
Emit("did-fail-load",
|
||||
error_code,
|
||||
error_description,
|
||||
url,
|
||||
is_main_frame,
|
||||
frame_process_id,
|
||||
frame_routing_id);
|
||||
Emit("did-fail-load", error_code, error_description, url, is_main_frame,
|
||||
frame_process_id, frame_routing_id);
|
||||
}
|
||||
|
||||
void WebContents::DidStartLoading() {
|
||||
|
@ -916,9 +909,9 @@ void WebContents::DidStartNavigation(
|
|||
bool is_main_frame = navigation_handle->IsInMainFrame();
|
||||
int frame_tree_node_id = navigation_handle->GetFrameTreeNodeId();
|
||||
content::FrameTreeNode* frame_tree_node =
|
||||
content::FrameTreeNode::GloballyFindByID(frame_tree_node_id);
|
||||
content::FrameTreeNode::GloballyFindByID(frame_tree_node_id);
|
||||
content::RenderFrameHostManager* render_manager =
|
||||
frame_tree_node->render_manager();
|
||||
frame_tree_node->render_manager();
|
||||
content::RenderFrameHost* frame_host = nullptr;
|
||||
if (render_manager) {
|
||||
frame_host = render_manager->speculative_frame_host();
|
||||
|
@ -932,12 +925,8 @@ void WebContents::DidStartNavigation(
|
|||
}
|
||||
bool is_same_document = navigation_handle->IsSameDocument();
|
||||
auto url = navigation_handle->GetURL();
|
||||
Emit("did-start-navigation",
|
||||
url,
|
||||
is_same_document,
|
||||
is_main_frame,
|
||||
frame_process_id,
|
||||
frame_routing_id);
|
||||
Emit("did-start-navigation", url, is_same_document, is_main_frame,
|
||||
frame_process_id, frame_routing_id);
|
||||
}
|
||||
|
||||
void WebContents::DidFinishNavigation(
|
||||
|
@ -946,7 +935,7 @@ void WebContents::DidFinishNavigation(
|
|||
return;
|
||||
bool is_main_frame = navigation_handle->IsInMainFrame();
|
||||
content::RenderFrameHost* frame_host =
|
||||
navigation_handle->GetRenderFrameHost();
|
||||
navigation_handle->GetRenderFrameHost();
|
||||
int frame_process_id = -1, frame_routing_id = -1;
|
||||
if (frame_host) {
|
||||
frame_process_id = frame_host->GetProcess()->GetID();
|
||||
|
@ -956,27 +945,19 @@ void WebContents::DidFinishNavigation(
|
|||
auto url = navigation_handle->GetURL();
|
||||
bool is_same_document = navigation_handle->IsSameDocument();
|
||||
if (is_same_document) {
|
||||
Emit("did-navigate-in-page",
|
||||
url,
|
||||
is_main_frame,
|
||||
frame_process_id,
|
||||
frame_routing_id);
|
||||
Emit("did-navigate-in-page", url, is_main_frame, frame_process_id,
|
||||
frame_routing_id);
|
||||
} else {
|
||||
const net::HttpResponseHeaders* http_response
|
||||
= navigation_handle->GetResponseHeaders();
|
||||
const net::HttpResponseHeaders* http_response =
|
||||
navigation_handle->GetResponseHeaders();
|
||||
std::string http_status_text;
|
||||
int http_response_code = -1;
|
||||
if (http_response) {
|
||||
http_status_text = http_response->GetStatusText();
|
||||
http_response_code = http_response->response_code();
|
||||
}
|
||||
Emit("did-frame-navigate",
|
||||
url,
|
||||
http_response_code,
|
||||
http_status_text,
|
||||
is_main_frame,
|
||||
frame_process_id,
|
||||
frame_routing_id);
|
||||
Emit("did-frame-navigate", url, http_response_code, http_status_text,
|
||||
is_main_frame, frame_process_id, frame_routing_id);
|
||||
if (is_main_frame) {
|
||||
Emit("did-navigate", url, http_response_code, http_status_text);
|
||||
}
|
||||
|
@ -985,23 +966,13 @@ void WebContents::DidFinishNavigation(
|
|||
auto url = navigation_handle->GetURL();
|
||||
int code = navigation_handle->GetNetErrorCode();
|
||||
auto description = net::ErrorToShortString(code);
|
||||
Emit("did-fail-provisional-load",
|
||||
code,
|
||||
description,
|
||||
url,
|
||||
is_main_frame,
|
||||
frame_process_id,
|
||||
frame_routing_id);
|
||||
Emit("did-fail-provisional-load", code, description, url, is_main_frame,
|
||||
frame_process_id, frame_routing_id);
|
||||
|
||||
// Do not emit "did-fail-load" for canceled requests.
|
||||
if (code != net::ERR_ABORTED)
|
||||
Emit("did-fail-load",
|
||||
code,
|
||||
description,
|
||||
url,
|
||||
is_main_frame,
|
||||
frame_process_id,
|
||||
frame_routing_id);
|
||||
Emit("did-fail-load", code, description, url, is_main_frame,
|
||||
frame_process_id, frame_routing_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue