content_settings_utils.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright 2021 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 COMPONENTS_EMBEDDER_SUPPORT_CONTENT_SETTINGS_UTILS_H_
  5. #define COMPONENTS_EMBEDDER_SUPPORT_CONTENT_SETTINGS_UTILS_H_
  6. #include "content/public/browser/allow_service_worker_result.h"
  7. #include "content/public/browser/global_routing_id.h"
  8. #include "third_party/abseil-cpp/absl/types/optional.h"
  9. #include "url/origin.h"
  10. class GURL;
  11. class HostContentSettingsMap;
  12. namespace blink {
  13. class StorageKey;
  14. } // namespace blink
  15. namespace content_settings {
  16. class CookieSettings;
  17. } // namespace content_settings
  18. namespace net {
  19. class SiteForCookies;
  20. } // namespace net
  21. namespace embedder_support {
  22. // See ContentBrowserClient::AllowServiceWorker.
  23. content::AllowServiceWorkerResult AllowServiceWorker(
  24. const GURL& scope,
  25. const net::SiteForCookies& site_for_cookies,
  26. const absl::optional<url::Origin>& top_frame_origin,
  27. const content_settings::CookieSettings* cookie_settings,
  28. const HostContentSettingsMap* settings_map);
  29. // See ContentBrowserClient::AllowSharedWorker. This also notifies content
  30. // settings of shared worker access.
  31. bool AllowSharedWorker(const GURL& worker_url,
  32. const net::SiteForCookies& site_for_cookies,
  33. const absl::optional<url::Origin>& top_frame_origin,
  34. const std::string& name,
  35. const blink::StorageKey& storage_key,
  36. int render_process_id,
  37. int render_frame_id,
  38. const content_settings::CookieSettings* cookie_settings);
  39. // See ContentBrowserClient::AllowWorkerFileSystem. This also notifies content
  40. // settings of file system access.
  41. bool AllowWorkerFileSystem(
  42. const GURL& url,
  43. const std::vector<content::GlobalRenderFrameHostId>& render_frames,
  44. const content_settings::CookieSettings* cookie_settings);
  45. // See ContentBrowserClient::AllowWorkerIndexedDB. This also notifies content
  46. // settings of Indexed DB access.
  47. bool AllowWorkerIndexedDB(
  48. const GURL& url,
  49. const std::vector<content::GlobalRenderFrameHostId>& render_frames,
  50. const content_settings::CookieSettings* cookie_settings);
  51. // See ContentBrowserClient::AllowWorkerCacheStorage. This also notifies content
  52. // settings of cache storage access.
  53. bool AllowWorkerCacheStorage(
  54. const GURL& url,
  55. const std::vector<content::GlobalRenderFrameHostId>& render_frames,
  56. const content_settings::CookieSettings* cookie_settings);
  57. // See ContentBrowserClient::AllowWorkerWebLocks.
  58. bool AllowWorkerWebLocks(
  59. const GURL& url,
  60. const content_settings::CookieSettings* cookie_settings);
  61. } // namespace embedder_support
  62. #endif // COMPONENTS_EMBEDDER_SUPPORT_CONTENT_SETTINGS_UTILS_H_