blob: eabfa312293c6c15179c38228f24642084d21f7a [file] [log] [blame]
// Copyright 2019 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.
#include "content/public/common/resource_type.h"
namespace content {
class BrowserContext;
namespace safe_browsing {
// This class implements the logic to decide whether the real time lookup
// feature is enabled for a given user/profile.
class RealTimePolicyEngine {
RealTimePolicyEngine() = delete;
~RealTimePolicyEngine() = delete;
// Is the feature to sync high confidence allowlist enabled?
static bool IsFetchAllowlistEnabled();
// Return true if full URL lookups are enabled for |resource_type|.
static bool CanPerformFullURLLookupForResourceType(
content::ResourceType resource_type);
// Return true if the feature to enable full URL lookups is enabled and the
// allowlist fetch is enabled for the profile represented by
// |browser_context|.
static bool CanPerformFullURLLookup(content::BrowserContext* browser_context);
friend class SafeBrowsingService;
// Is the feature to perform real-time URL lookup enabled?
static bool IsUrlLookupEnabled();
// Is user opted-in to the feature?
static bool IsUserOptedIn(content::BrowserContext* browser_context);
// Is the feature enabled due to enterprise policy?
static bool IsEnabledByPolicy(content::BrowserContext* browser_context);
friend class RealTimePolicyEngineTest;
}; // class RealTimePolicyEngine
} // namespace safe_browsing