Commit 2989c73a authored by Karan Bhatia's avatar Karan Bhatia Committed by Commit Bot

WebRequest: Rename is_browser_side_navigation to is_navigation_request.

Rename is_browser_side_navigation to is_navigation_request in WebRequestInfo.
Since PlzNavigate is launched all navigations are "browser-side".

BUG=None

Change-Id: Ib0b3b4105186a4ef5bbde1e25fd3aad8a44279d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1668341Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#671741}
parent bbd48153
...@@ -53,7 +53,7 @@ const char kRuleId4[] = "rule4"; ...@@ -53,7 +53,7 @@ const char kRuleId4[] = "rule4";
WebRequestInfoInitParams CreateRequestParams(const GURL& url) { WebRequestInfoInitParams CreateRequestParams(const GURL& url) {
WebRequestInfoInitParams info; WebRequestInfoInitParams info;
info.url = url; info.url = url;
info.is_browser_side_navigation = true; info.is_navigation_request = true;
info.type = content::ResourceType::kMainFrame; info.type = content::ResourceType::kMainFrame;
info.web_request_type = WebRequestResourceType::MAIN_FRAME; info.web_request_type = WebRequestResourceType::MAIN_FRAME;
return info; return info;
......
...@@ -127,14 +127,14 @@ TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, LocalNTPRequests) { ...@@ -127,14 +127,14 @@ TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, LocalNTPRequests) {
auto create_request_params = auto create_request_params =
[&example_com](const url::Origin& initiator, content::ResourceType type, [&example_com](const url::Origin& initiator, content::ResourceType type,
extensions::WebRequestResourceType web_request_type, extensions::WebRequestResourceType web_request_type,
bool is_browser_side_navigation) { bool is_navigation_request) {
WebRequestInfoInitParams info_params; WebRequestInfoInitParams info_params;
info_params.url = example_com; info_params.url = example_com;
info_params.initiator = initiator; info_params.initiator = initiator;
info_params.render_process_id = -1; info_params.render_process_id = -1;
info_params.type = type; info_params.type = type;
info_params.web_request_type = web_request_type; info_params.web_request_type = web_request_type;
info_params.is_browser_side_navigation = is_browser_side_navigation; info_params.is_navigation_request = is_navigation_request;
return info_params; return info_params;
}; };
......
...@@ -2021,9 +2021,9 @@ void ExtensionWebRequestEventRouter::GetMatchingListenersImpl( ...@@ -2021,9 +2021,9 @@ void ExtensionWebRequestEventRouter::GetMatchingListenersImpl(
} }
if (request->is_web_view) { if (request->is_web_view) {
// If this is a PlzNavigate request, then we can skip this check. IDs will // If this is a navigation request, then we can skip this check. IDs will
// be -1 and the request is trusted. // be -1 and the request is trusted.
if (!request->is_browser_side_navigation && if (!request->is_navigation_request &&
(listener->id.render_process_id != (listener->id.render_process_id !=
request->web_view_embedder_process_id)) { request->web_view_embedder_process_id)) {
continue; continue;
......
...@@ -170,7 +170,7 @@ WebRequestInfoInitParams::WebRequestInfoInitParams( ...@@ -170,7 +170,7 @@ WebRequestInfoInitParams::WebRequestInfoInitParams(
routing_id(routing_id), routing_id(routing_id),
frame_id(render_frame_id), frame_id(render_frame_id),
method(request.method), method(request.method),
is_browser_side_navigation(!!navigation_ui_data), is_navigation_request(!!navigation_ui_data),
initiator(request.request_initiator), initiator(request.request_initiator),
type(static_cast<content::ResourceType>(request.resource_type)), type(static_cast<content::ResourceType>(request.resource_type)),
is_async(is_async), is_async(is_async),
...@@ -236,7 +236,7 @@ WebRequestInfo::WebRequestInfo(WebRequestInfoInitParams params) ...@@ -236,7 +236,7 @@ WebRequestInfo::WebRequestInfo(WebRequestInfoInitParams params)
routing_id(params.routing_id), routing_id(params.routing_id),
frame_id(params.frame_id), frame_id(params.frame_id),
method(std::move(params.method)), method(std::move(params.method)),
is_browser_side_navigation(params.is_browser_side_navigation), is_navigation_request(params.is_navigation_request),
initiator(std::move(params.initiator)), initiator(std::move(params.initiator)),
frame_data(std::move(params.frame_data)), frame_data(std::move(params.frame_data)),
type(params.type), type(params.type),
......
...@@ -65,7 +65,7 @@ struct WebRequestInfoInitParams { ...@@ -65,7 +65,7 @@ struct WebRequestInfoInitParams {
int routing_id = MSG_ROUTING_NONE; int routing_id = MSG_ROUTING_NONE;
int frame_id = -1; int frame_id = -1;
std::string method; std::string method;
bool is_browser_side_navigation = false; bool is_navigation_request = false;
base::Optional<url::Origin> initiator; base::Optional<url::Origin> initiator;
base::Optional<content::ResourceType> type; base::Optional<content::ResourceType> type;
WebRequestResourceType web_request_type = WebRequestResourceType::OTHER; WebRequestResourceType web_request_type = WebRequestResourceType::OTHER;
...@@ -119,7 +119,7 @@ struct WebRequestInfo { ...@@ -119,7 +119,7 @@ struct WebRequestInfo {
const std::string method; const std::string method;
// Indicates whether the request is for a browser-side navigation. // Indicates whether the request is for a browser-side navigation.
const bool is_browser_side_navigation; const bool is_navigation_request;
// The origin of the context which initiated the request. May be null for // The origin of the context which initiated the request. May be null for
// browser-initiated requests such as navigations. // browser-initiated requests such as navigations.
......
...@@ -249,7 +249,7 @@ bool WebRequestPermissions::HideRequest( ...@@ -249,7 +249,7 @@ bool WebRequestPermissions::HideRequest(
if (is_request_from_browser) { if (is_request_from_browser) {
// Hide all non-navigation requests made by the browser. crbug.com/884932. // Hide all non-navigation requests made by the browser. crbug.com/884932.
if (!request.is_browser_side_navigation && if (!request.is_navigation_request &&
request.type != content::ResourceType::kNavigationPreload) { request.type != content::ResourceType::kNavigationPreload) {
return true; return true;
} }
......
...@@ -113,9 +113,8 @@ TEST(ExtensionWebRequestPermissions, TestHideRequestForURL) { ...@@ -113,9 +113,8 @@ TEST(ExtensionWebRequestPermissions, TestHideRequestForURL) {
request.render_process_id = render_process_id; request.render_process_id = render_process_id;
request.web_request_type = ToWebRequestResourceType(type); request.web_request_type = ToWebRequestResourceType(type);
request.is_browser_side_navigation = request.is_navigation_request = type == content::ResourceType::kMainFrame ||
type == content::ResourceType::kMainFrame || type == content::ResourceType::kSubFrame;
type == content::ResourceType::kSubFrame;
return request; return request;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment