url_loader_context.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef SERVICES_NETWORK_URL_LOADER_CONTEXT_H_
  5. #define SERVICES_NETWORK_URL_LOADER_CONTEXT_H_
  6. #include "base/component_export.h"
  7. #include "base/memory/ref_counted.h"
  8. #include "services/network/public/cpp/corb/corb_api.h"
  9. namespace net {
  10. class URLRequestContext;
  11. } // namespace net
  12. namespace network {
  13. class ResourceSchedulerClient;
  14. namespace cors {
  15. class OriginAccessList;
  16. } // namespace cors
  17. namespace mojom {
  18. class CookieAccessObserver;
  19. class CrossOriginEmbedderPolicyReporter;
  20. class DevToolsObserver;
  21. class NetworkContextClient;
  22. class TrustedURLLoaderHeaderClient;
  23. class URLLoaderFactoryParams;
  24. class URLLoaderNetworkServiceObserver;
  25. } // namespace mojom
  26. // An interface implemented in production code by network::URLLoaderFactory (or
  27. // by URLLoaderContextForTests in unit tests).
  28. class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoaderContext {
  29. public:
  30. virtual bool ShouldRequireNetworkIsolationKey() const = 0;
  31. virtual const cors::OriginAccessList& GetOriginAccessList() const = 0;
  32. virtual const mojom::URLLoaderFactoryParams& GetFactoryParams() const = 0;
  33. virtual mojom::CookieAccessObserver* GetCookieAccessObserver() const = 0;
  34. virtual mojom::CrossOriginEmbedderPolicyReporter* GetCoepReporter() const = 0;
  35. virtual mojom::DevToolsObserver* GetDevToolsObserver() const = 0;
  36. virtual mojom::NetworkContextClient* GetNetworkContextClient() const = 0;
  37. virtual mojom::TrustedURLLoaderHeaderClient* GetUrlLoaderHeaderClient()
  38. const = 0;
  39. virtual mojom::URLLoaderNetworkServiceObserver*
  40. GetURLLoaderNetworkServiceObserver() const = 0;
  41. virtual net::URLRequestContext* GetUrlRequestContext() const = 0;
  42. virtual scoped_refptr<ResourceSchedulerClient> GetResourceSchedulerClient()
  43. const = 0;
  44. virtual corb::PerFactoryState& GetMutableCorbState() = 0;
  45. protected:
  46. // `protected` destructor = can only destruct via concrete implementations
  47. // (and not via an URLLoaderContext pointer).
  48. virtual ~URLLoaderContext() {}
  49. };
  50. } // namespace network
  51. #endif // SERVICES_NETWORK_URL_LOADER_CONTEXT_H_