| // Copyright 2016 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module chrome.mojom; |
| |
| import "components/content_settings/common/content_settings_manager.mojom"; |
| import "components/content_settings/core/common/content_settings.mojom"; |
| import "mojo/public/mojom/base/time.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| // Renderer configuration for a bound session. |
| // Network requests with `domain` and that are on `path` require a short lived |
| // cookie that would expire at `cookie_expiry_date`. Renderer throtller relies |
| // on `BoundSessionThrottlerParams` to defer a request when required. |
| // `BoundSessionThrottlerParams` can change when a bound session is created, |
| // terminated or on cookie expiration change. |
| [EnableIf=enable_bound_session_credentials] |
| struct BoundSessionThrottlerParams { |
| string domain; |
| string path; |
| mojo_base.mojom.Time cookie_expiry_date; |
| }; |
| |
| // The renderer configuration parameters which can change post renderer launch. |
| struct DynamicParams { |
| // `BoundSessionThrottlerParams` can be empty if there are no bound sessions. |
| [EnableIf=enable_bound_session_credentials] |
| array<BoundSessionThrottlerParams> bound_session_throttler_params; |
| bool force_safe_search = true; |
| int32 youtube_restrict = 0; |
| string allowed_domains_for_apps; |
| }; |
| |
| // Event triggering release of blocked requests. |
| // These values are persisted to logs. Entries should not be renumbered and |
| // numeric values should never be reused. |
| [EnableIf=enable_bound_session_credentials] |
| enum ResumeBlockedRequestsTrigger { |
| kObservedFreshCookies = 0, |
| kCookieRefreshFetchSuccess = 1, |
| kCookieRefreshFetchFailure = 2, |
| // kNetworkConnectionOffline = 3, Deprecated |
| kTimeout = 4, |
| kShutdownOrSessionTermination = 5, |
| kCookieAlreadyFresh = 6, |
| kRendererDisconnected = 7, |
| kThrottlingRequestsPaused = 8, |
| }; |
| |
| // Allows the renderer to notify the browser process that requests in renderer |
| // are throttled and require a fresh short lived cookie. |
| interface BoundSessionRequestThrottledHandler { |
| // Called to notify the browser process when a network request requires a |
| // fresh cookie. This triggers a cookie refresh request and will |
| // run the callback to release the request upon success, failure or timeout. |
| // |untrusted_request_url| is used to determine which bound sessions cover |
| // the request. |
| // TODO(crbug.com/41495201): Remove this interface when DBSC is migrated to |
| // the network stack. |
| [EnableIf=enable_bound_session_credentials] |
| HandleRequestBlockedOnCookie(url.mojom.Url untrusted_request_url) |
| => (ResumeBlockedRequestsTrigger resume_trigger); |
| }; |
| |
| interface ChromeOSListener { |
| // Call when the merge session process (cookie reconstruction from |
| // OAuth2 refresh token in ChromeOS login) is complete. All XHR's |
| // will be throttled until unlocked by this call. |
| [EnableIf=is_chromeos_ash] |
| MergeSessionComplete(); |
| }; |
| |
| // Configures the renderer. |
| interface RendererConfiguration { |
| // Configures the renderer with settings that won't change. |
| // The |chromeos_listener| is only passed on Chrome OS when |
| // the merge session is still running - otherwise not set. |
| // |content_settings_manager| may be sent as an optimization to avoid |
| // requesting it from the browser process, and may be null. |
| // |bound_session_request_throttled_handler| is passed only if the buildflag |
| // `enable_bound_session_credentials` is enabled. It can be null if bound |
| // sessions are not supported yet for the current profile type. |
| SetInitialConfiguration( |
| bool is_incognito_process, |
| pending_receiver<ChromeOSListener>? chromeos_listener, |
| pending_remote<content_settings.mojom.ContentSettingsManager>? |
| content_settings_manager, |
| pending_remote<BoundSessionRequestThrottledHandler>? |
| bound_session_request_throttled_handler); |
| |
| // Update renderer configuration with settings that can change. |
| SetConfiguration(DynamicParams params); |
| }; |