diff options
Diffstat (limited to 'chromium/chrome/renderer/url_loader_throttle_provider_impl.h')
-rw-r--r-- | chromium/chrome/renderer/url_loader_throttle_provider_impl.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/chromium/chrome/renderer/url_loader_throttle_provider_impl.h b/chromium/chrome/renderer/url_loader_throttle_provider_impl.h new file mode 100644 index 00000000000..ae5b86d9b69 --- /dev/null +++ b/chromium/chrome/renderer/url_loader_throttle_provider_impl.h @@ -0,0 +1,78 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_URL_LOADER_THROTTLE_PROVIDER_IMPL_H_ +#define CHROME_RENDERER_URL_LOADER_THROTTLE_PROVIDER_IMPL_H_ + +#include <memory> +#include <vector> + +#include "base/threading/thread_checker.h" +#include "components/data_reduction_proxy/core/common/data_reduction_proxy.mojom.h" +#include "components/safe_browsing/common/safe_browsing.mojom.h" +#include "content/public/renderer/url_loader_throttle_provider.h" +#include "extensions/buildflags/buildflags.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" + +#if BUILDFLAG(ENABLE_EXTENSIONS) +#include "extensions/renderer/extension_throttle_manager.h" +#endif + +namespace data_reduction_proxy { +class DataReductionProxyThrottleManager; +} + +class ChromeContentRendererClient; + +// Instances must be constructed on the render thread, and then used and +// destructed on a single thread, which can be different from the render thread. +class URLLoaderThrottleProviderImpl + : public content::URLLoaderThrottleProvider { + public: + URLLoaderThrottleProviderImpl( + blink::ThreadSafeBrowserInterfaceBrokerProxy* broker, + content::URLLoaderThrottleProviderType type, + ChromeContentRendererClient* chrome_content_renderer_client); + + ~URLLoaderThrottleProviderImpl() override; + + // content::URLLoaderThrottleProvider implementation. + std::unique_ptr<content::URLLoaderThrottleProvider> Clone() override; + std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateThrottles( + int render_frame_id, + const blink::WebURLRequest& request, + content::ResourceType resource_type) override; + void SetOnline(bool is_online) override; + + private: + // This copy constructor works in conjunction with Clone(), not intended for + // general use. + URLLoaderThrottleProviderImpl(const URLLoaderThrottleProviderImpl& other); + + content::URLLoaderThrottleProviderType type_; + ChromeContentRendererClient* const chrome_content_renderer_client_; + + mojo::PendingRemote<safe_browsing::mojom::SafeBrowsing> safe_browsing_remote_; + mojo::Remote<safe_browsing::mojom::SafeBrowsing> safe_browsing_; + + mojo::PendingRemote<data_reduction_proxy::mojom::DataReductionProxy> + data_reduction_proxy_remote_; + mojo::Remote<data_reduction_proxy::mojom::DataReductionProxy> + data_reduction_proxy_; + std::unique_ptr<data_reduction_proxy::DataReductionProxyThrottleManager> + data_reduction_proxy_manager_; + +#if BUILDFLAG(ENABLE_EXTENSIONS) + std::unique_ptr<extensions::ExtensionThrottleManager> + extension_throttle_manager_; +#endif + + THREAD_CHECKER(thread_checker_); + + DISALLOW_ASSIGN(URLLoaderThrottleProviderImpl); +}; + +#endif // CHROME_RENDERER_URL_LOADER_THROTTLE_PROVIDER_IMPL_H_ |