#include "chrome/test/supervised_user/test_state_seeded_observer.h"
#include <memory>
#include <optional>
#include <ostream>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/task/task_traits.h"
#include "base/test/bind.h"
#include "base/version_info/channel.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/test/supervised_user/family_member.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/supervised_user/core/browser/fetcher_config.h"
#include "components/supervised_user/core/browser/proto/kidsmanagement_messages.pb.h"
#include "components/supervised_user/core/browser/proto_fetcher.h"
#include "components/supervised_user/core/browser/proto_fetcher_status.h"
#include "components/supervised_user/core/browser/supervised_user_preferences.h"
#include "components/supervised_user/core/browser/supervised_user_service.h"
#include "components/supervised_user/core/browser/supervised_user_service_observer.h"
#include "components/supervised_user/core/browser/supervised_user_url_filter.h"
#include "components/supervised_user/core/common/pref_names.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "url/gurl.h"
namespace supervised_user {
std::ostream& operator<<(std::ostream& os, const FilteringBehavior& fb) { … }
namespace {
std::string GetToggleAbbrev(FamilyLinkToggleType toggle) { … }
net::NetworkTrafficAnnotationTag TestStateSeedTag() { … }
constexpr FetcherConfig kDefineChromeTestStateConfig{ … };
constexpr FetcherConfig kResetChromeTestStateConfig{ … };
inline void AddWebsiteException(
kidsmanagement::DefineChromeTestStateRequest& request,
const GURL& url,
kidsmanagement::ExceptionType exception_type) { … }
void WaitForRequestToComplete(const FamilyMember& supervising_user,
const FamilyMember& browser_user,
const FetcherConfig& config,
std::string_view serialized_request) { … }
bool AreSafeSitesConfigured(const FamilyMember& member) { … }
bool IsUrlConfigured(SupervisedUserURLFilter& url_filter,
const GURL& url,
FilteringBehavior expected_filtering_behavior) { … }
bool UrlFiltersAreConfigured(const FamilyMember& family_member,
const std::optional<GURL>& allowed_url,
const std::optional<GURL>& blocked_url) { … }
bool UrlFiltersAreEmpty(const FamilyMember& family_member) { … }
bool ToggleHasExpectedValue(const FamilyMember& browser_user,
FamilyLinkToggleConfiguration toggle) { … }
}
BrowserState::~BrowserState() = default;
BrowserState::BrowserState(const Intent* intent) : … { … }
BrowserState BrowserState::Reset() { … }
BrowserState BrowserState::EnableSafeSites() { … }
BrowserState BrowserState::AllowSite(const GURL& gurl) { … }
BrowserState BrowserState::BlockSite(const GURL& gurl) { … }
BrowserState BrowserState::AdvancedSettingsToggles(
std::list<FamilyLinkToggleConfiguration> toggle_list) { … }
BrowserState BrowserState::SetAdvancedSettingsDefault() { … }
void BrowserState::Seed(const FamilyMember& supervising_user,
const FamilyMember& browser_user) const { … }
bool BrowserState::Check(const FamilyMember& browser_user) const { … }
std::string BrowserState::ToString() const { … }
BrowserState::Intent::~Intent() = default;
BrowserState::ResetIntent::~ResetIntent() = default;
std::string BrowserState::ResetIntent::GetRequest() const { … }
const FetcherConfig& BrowserState::ResetIntent::GetConfig() const { … }
std::string BrowserState::ResetIntent::ToString() const { … }
bool BrowserState::ResetIntent::Check(const FamilyMember& browser_user) const { … }
BrowserState::DefineManualSiteListIntent::DefineManualSiteListIntent() =
default;
BrowserState::DefineManualSiteListIntent::DefineManualSiteListIntent(
AllowUrl url)
: … { … }
BrowserState::DefineManualSiteListIntent::DefineManualSiteListIntent(
BlockUrl url)
: … { … }
BrowserState::DefineManualSiteListIntent::~DefineManualSiteListIntent() =
default;
std::string BrowserState::DefineManualSiteListIntent::GetRequest() const { … }
const supervised_user::FetcherConfig&
BrowserState::DefineManualSiteListIntent::GetConfig() const { … }
std::string BrowserState::DefineManualSiteListIntent::ToString() const { … }
bool BrowserState::DefineManualSiteListIntent::Check(
const FamilyMember& browser_user) const { … }
BrowserState::ToggleIntent::ToggleIntent(
std::list<FamilyLinkToggleConfiguration> toggle_list)
: … { … }
BrowserState::ToggleIntent::~ToggleIntent() = default;
std::string BrowserState::ToggleIntent::GetRequest() const { … }
const FetcherConfig& BrowserState::ToggleIntent::GetConfig() const { … }
std::string BrowserState::ToggleIntent::ToString() const { … }
bool BrowserState::ToggleIntent::Check(const FamilyMember& browser_user) const { … }
}