chromium/components/permissions/permission_recovery_success_rate_tracker.h

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

#ifndef COMPONENTS_PERMISSIONS_PERMISSION_RECOVERY_SUCCESS_RATE_TRACKER_H_
#define COMPONENTS_PERMISSIONS_PERMISSION_RECOVERY_SUCCESS_RATE_TRACKER_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"

namespace permissions {

// This class track permissions that were reallowed via PageInfo. In addition,
// it records if the "Reload this page" infobar was shown or if a page was
// reloaded. The reload may be initiated via the infobar or any other UI
// elements. The recording happens when a main frame is going to be destroyed.
// That may happen while a tab is being closed or while cross-origin navigation.
//
// The recording happens instantly if permission is used by an origin as the
// goal is to verify permission usage after it was reallowed.
class PermissionRecoverySuccessRateTracker
    : public content::WebContentsObserver,
      public content::WebContentsUserData<
          PermissionRecoverySuccessRateTracker> {};

}  // namespace permissions

#endif  // COMPONENTS_PERMISSIONS_PERMISSION_RECOVERY_SUCCESS_RATE_TRACKER_H_