#include "chrome/browser/enterprise/browser_management/browser_management_status_provider.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile.h"
#include "components/enterprise/browser/controller/browser_dm_token_storage.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_service.h"
#if BUILDFLAG(IS_WIN)
#include "components/policy/core/common/management/platform_management_status_provider_win.h"
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h"
#include "chrome/browser/ash/profiles/profile_helper.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "components/user_manager/user_manager.h"
#endif
namespace {
bool IsProfileManaged(Profile* profile) { … }
}
BrowserCloudManagementStatusProvider::BrowserCloudManagementStatusProvider() =
default;
BrowserCloudManagementStatusProvider::~BrowserCloudManagementStatusProvider() =
default;
EnterpriseManagementAuthority
BrowserCloudManagementStatusProvider::FetchAuthority() { … }
LocalBrowserManagementStatusProvider::LocalBrowserManagementStatusProvider() =
default;
LocalBrowserManagementStatusProvider::~LocalBrowserManagementStatusProvider() =
default;
EnterpriseManagementAuthority
LocalBrowserManagementStatusProvider::FetchAuthority() { … }
LocalDomainBrowserManagementStatusProvider::
LocalDomainBrowserManagementStatusProvider() = default;
LocalDomainBrowserManagementStatusProvider::
~LocalDomainBrowserManagementStatusProvider() = default;
EnterpriseManagementAuthority
LocalDomainBrowserManagementStatusProvider::FetchAuthority() { … }
ProfileCloudManagementStatusProvider::ProfileCloudManagementStatusProvider(
Profile* profile)
: … { … }
ProfileCloudManagementStatusProvider::~ProfileCloudManagementStatusProvider() =
default;
EnterpriseManagementAuthority
ProfileCloudManagementStatusProvider::FetchAuthority() { … }
LocalTestPolicyUserManagementProvider::LocalTestPolicyUserManagementProvider(
Profile* profile)
: … { … }
LocalTestPolicyUserManagementProvider::
~LocalTestPolicyUserManagementProvider() = default;
EnterpriseManagementAuthority
LocalTestPolicyUserManagementProvider::FetchAuthority() { … }
LocalTestPolicyBrowserManagementProvider::
LocalTestPolicyBrowserManagementProvider(Profile* profile)
: … { … }
LocalTestPolicyBrowserManagementProvider::
~LocalTestPolicyBrowserManagementProvider() = default;
EnterpriseManagementAuthority
LocalTestPolicyBrowserManagementProvider::FetchAuthority() { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
DeviceManagementStatusProvider::DeviceManagementStatusProvider() = default;
DeviceManagementStatusProvider::~DeviceManagementStatusProvider() = default;
EnterpriseManagementAuthority DeviceManagementStatusProvider::FetchAuthority() {
return g_browser_process && g_browser_process->platform_part() &&
g_browser_process->platform_part()
->browser_policy_connector_ash() &&
g_browser_process->platform_part()
->browser_policy_connector_ash()
->IsDeviceEnterpriseManaged()
? EnterpriseManagementAuthority::CLOUD_DOMAIN
: EnterpriseManagementAuthority::NONE;
}
#endif