Commit 44dcfabf authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Chromium LUCI CQ

Deprecate blink::mojom::ResourceType in PluginResponseInterceptorURLLoaderThrottle

This CL replaces blink::mojom::ResourceType with
network::mojom::RequestDestination in
PluginResponseInterceptorURLLoaderThrottle since
blink::mojom::ResourceType is deprecated[1].

It replaces |resource_type_| with |request_destination_| in
PluginResponseInterceptorURLLoaderThrottle and uses it to
check if the request is for the main frame.

[1] https://crbug.com/960143

Bug: 1059639
Change-Id: Id4e5803ea8bbbb35b0953773184e4ac86ec40d3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2637121Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#845090}
parent 3d306ff0
...@@ -6061,6 +6061,7 @@ static_library("browser") { ...@@ -6061,6 +6061,7 @@ static_library("browser") {
"//ppapi/host", "//ppapi/host",
"//ppapi/proxy:ipc", "//ppapi/proxy:ipc",
"//services/device/public/mojom", "//services/device/public/mojom",
"//services/network/public/mojom",
] ]
if (is_chromeos_ash) { if (is_chromeos_ash) {
deps += [ "//chromeos/cryptohome" ] deps += [ "//chromeos/cryptohome" ]
......
...@@ -4538,7 +4538,7 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles( ...@@ -4538,7 +4538,7 @@ ChromeContentBrowserClient::CreateURLLoaderThrottles(
#if BUILDFLAG(ENABLE_PLUGINS) #if BUILDFLAG(ENABLE_PLUGINS)
result.push_back(std::make_unique<PluginResponseInterceptorURLLoaderThrottle>( result.push_back(std::make_unique<PluginResponseInterceptorURLLoaderThrottle>(
request.resource_type, frame_tree_node_id)); request.destination, frame_tree_node_id));
#endif #endif
auto delegate = auto delegate =
......
...@@ -24,13 +24,14 @@ ...@@ -24,13 +24,14 @@
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/cpp/system/data_pipe.h"
#include "services/network/public/mojom/url_response_head.mojom.h" #include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom.h" #include "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom.h"
PluginResponseInterceptorURLLoaderThrottle:: PluginResponseInterceptorURLLoaderThrottle::
PluginResponseInterceptorURLLoaderThrottle(int resource_type, PluginResponseInterceptorURLLoaderThrottle(
int frame_tree_node_id) network::mojom::RequestDestination request_destination,
: resource_type_(resource_type), frame_tree_node_id_(frame_tree_node_id) {} int frame_tree_node_id)
: request_destination_(request_destination),
frame_tree_node_id_(frame_tree_node_id) {}
PluginResponseInterceptorURLLoaderThrottle:: PluginResponseInterceptorURLLoaderThrottle::
~PluginResponseInterceptorURLLoaderThrottle() = default; ~PluginResponseInterceptorURLLoaderThrottle() = default;
...@@ -123,8 +124,8 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse( ...@@ -123,8 +124,8 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(
transferrable_loader->head = std::move(deep_copied_response); transferrable_loader->head = std::move(deep_copied_response);
transferrable_loader->head->intercepted_by_plugin = true; transferrable_loader->head->intercepted_by_plugin = true;
bool embedded = resource_type_ != bool embedded =
static_cast<int>(blink::mojom::ResourceType::kMainFrame); request_destination_ != network::mojom::RequestDestination::kDocument;
content::GetUIThreadTaskRunner({})->PostTask( content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, FROM_HERE,
base::BindOnce( base::BindOnce(
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h"
// Used to watch navigation responses to look for mime types that are handled by // Used to watch navigation responses to look for mime types that are handled by
...@@ -23,7 +24,7 @@ class PluginResponseInterceptorURLLoaderThrottle ...@@ -23,7 +24,7 @@ class PluginResponseInterceptorURLLoaderThrottle
: public blink::URLLoaderThrottle { : public blink::URLLoaderThrottle {
public: public:
PluginResponseInterceptorURLLoaderThrottle( PluginResponseInterceptorURLLoaderThrottle(
int resource_type, network::mojom::RequestDestination request_destination,
int frame_tree_node_id); int frame_tree_node_id);
~PluginResponseInterceptorURLLoaderThrottle() override; ~PluginResponseInterceptorURLLoaderThrottle() override;
...@@ -36,7 +37,7 @@ class PluginResponseInterceptorURLLoaderThrottle ...@@ -36,7 +37,7 @@ class PluginResponseInterceptorURLLoaderThrottle
// layer chance to initialize its browser side state. // layer chance to initialize its browser side state.
void ResumeLoad(); void ResumeLoad();
const int resource_type_; const network::mojom::RequestDestination request_destination_;
const int frame_tree_node_id_; const int frame_tree_node_id_;
base::WeakPtrFactory<PluginResponseInterceptorURLLoaderThrottle> base::WeakPtrFactory<PluginResponseInterceptorURLLoaderThrottle>
......
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