#include "chrome/browser/permissions/contextual_notification_permission_ui_selector.h"
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/rand_util.h"
#include "base/time/default_clock.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/permissions/quiet_notification_permission_ui_config.h"
#include "chrome/browser/permissions/quiet_notification_permission_ui_state.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/common/chrome_features.h"
#include "components/permissions/permission_request.h"
#include "components/permissions/request_type.h"
#include "components/safe_browsing/core/browser/db/database_manager.h"
namespace {
QuietUiReason;
WarningReason;
Decision;
void RecordNotificationUserExperienceQuality(
CrowdDenyPreloadData::SiteReputation::NotificationUserExperienceQuality
value) { … }
std::optional<Decision> GetDecisionBasedOnSiteReputation(
const CrowdDenyPreloadData::SiteReputation* site_reputation) { … }
bool ShouldHoldBackQuietUI(QuietUiReason quiet_ui_reason) { … }
}
ContextualNotificationPermissionUiSelector::
ContextualNotificationPermissionUiSelector() = default;
void ContextualNotificationPermissionUiSelector::SelectUiToUse(
permissions::PermissionRequest* request,
DecisionMadeCallback callback) { … }
void ContextualNotificationPermissionUiSelector::Cancel() { … }
bool ContextualNotificationPermissionUiSelector::IsPermissionRequestSupported(
permissions::RequestType request_type) { … }
ContextualNotificationPermissionUiSelector::
~ContextualNotificationPermissionUiSelector() = default;
void ContextualNotificationPermissionUiSelector::EvaluatePerSiteTriggers(
const url::Origin& origin) { … }
void ContextualNotificationPermissionUiSelector::OnSiteReputationReady(
const url::Origin& origin,
const CrowdDenyPreloadData::SiteReputation* reputation) { … }
void ContextualNotificationPermissionUiSelector::OnSafeBrowsingVerdictReceived(
Decision candidate_decision,
CrowdDenySafeBrowsingRequest::Verdict verdict) { … }
void ContextualNotificationPermissionUiSelector::Notify(
const Decision& decision) { … }