| // Copyright 2020 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. |
| |
| module network.mojom; |
| |
| import "url/mojom/url.mojom"; |
| import "services/network/public/mojom/site_for_cookies.mojom"; |
| import "services/network/public/mojom/cookie_manager.mojom"; |
| |
| struct CookieAccessDetails { |
| enum Type { |
| kRead, |
| kChange, |
| }; |
| |
| // Whether this request corresponds to a cookie read or a cookie write. |
| Type type; |
| |
| // If the cookies are accessed by a network transfer, |url| is the URL being |
| // loaded; if they're read by a script, it's the URL of window or service |
| // worker script looking them up. |
| url.mojom.Url url; |
| |
| SiteForCookies site_for_cookies; |
| array<CookieWithAccessResult> cookie_list; |
| |
| // |devtools_request_id| contains the DevTools request id of the request |
| // that triggered the cookie change, if the read was triggered by a request. |
| string? devtools_request_id; |
| }; |
| |
| // Cloneable interface to observe the cookie reads or writes. |
| // The user of the NetworkService should create a dedicated |
| // CookieAccessObserver for each context it is interested in. |
| interface CookieAccessObserver { |
| // Called when an attempt has been made to access (read or write) the cookies |
| // in |details.cookie_list|, with the status indicating cookies were actually |
| // used or blocked, and if so, gives the reason. Currently blocked cookies |
| // are included if they are blocked by user preference, or if they warrant |
| // a console deprecation warning. |
| OnCookiesAccessed(CookieAccessDetails details); |
| |
| // Used by the NetworkService to create a copy of this observer. |
| // (e.g. when creating an observer for URLLoader from URLLoaderFactory's |
| // observer). |
| Clone(pending_receiver<CookieAccessObserver> listener); |
| }; |