chromium/chrome/browser/tpcd/support/validity_service.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_TPCD_SUPPORT_VALIDITY_SERVICE_H_
#define CHROME_BROWSER_TPCD_SUPPORT_VALIDITY_SERVICE_H_

#include "base/functional/callback.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"

class HostContentSettingsMap;
class GURL;

namespace tpcd::trial {

// ValidityService is responsible for ensuring the Tpcd deprecation trials (for
// third-parties and for top-level sites) is still enabled for the appropriate
// origin of any third-party cookie access that is (or could have been) allowed
// as a result of a |TPCD_TRIAL| or |TOP_LEVEL_TPCD_TRIAL| content setting. This
// is necessary since |content::OriginTrialsControllerDelegate| doesn't notify
// its observers when a trial is disabled for a reason other than all tokens
// being cleared or an origin intentionally disable it (by not supplying the
// token when loaded in the associated context).
class ValidityService : public content::WebContentsObserver,
                        public content::WebContentsUserData<ValidityService> {};

}  // namespace tpcd::trial

#endif  // CHROME_BROWSER_TPCD_SUPPORT_VALIDITY_SERVICE_H_