#include "chrome/updater/policy/dm_policy_manager.h"
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/enterprise_util.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/enterprise_companion/device_management_storage/dm_storage.h"
#include "chrome/updater/constants.h"
#include "chrome/updater/device_management/dm_message.h"
#include "chrome/updater/policy/manager.h"
#include "chrome/updater/protos/omaha_settings.pb.h"
#include "device_management_backend.pb.h"
namespace updater {
namespace {
int PolicyValueFromProtoInstallDefaultValue(
::wireless_android_enterprise_devicemanagement::InstallDefaultValue
install_default_value) { … }
int PolicyValueFromProtoInstallValue(
::wireless_android_enterprise_devicemanagement::InstallValue
install_value) { … }
int PolicyValueFromProtoUpdateValue(
::wireless_android_enterprise_devicemanagement::UpdateValue update_value) { … }
}
DMPolicyManager::DMPolicyManager(
const ::wireless_android_enterprise_devicemanagement::
OmahaSettingsClientProto& omaha_settings,
const std::optional<bool>& override_is_managed_device)
: … { … }
DMPolicyManager::~DMPolicyManager() = default;
bool DMPolicyManager::HasActiveDevicePolicies() const { … }
std::string DMPolicyManager::source() const { … }
std::optional<bool> DMPolicyManager::CloudPolicyOverridesPlatformPolicy()
const { … }
std::optional<base::TimeDelta> DMPolicyManager::GetLastCheckPeriod() const { … }
std::optional<UpdatesSuppressedTimes>
DMPolicyManager::GetUpdatesSuppressedTimes() const { … }
std::optional<std::string> DMPolicyManager::GetDownloadPreference() const { … }
std::optional<int> DMPolicyManager::GetPackageCacheSizeLimitMBytes() const { … }
std::optional<int> DMPolicyManager::GetPackageCacheExpirationTimeDays() const { … }
std::optional<std::string> DMPolicyManager::GetProxyMode() const { … }
std::optional<std::string> DMPolicyManager::GetProxyPacUrl() const { … }
std::optional<std::string> DMPolicyManager::GetProxyServer() const { … }
const ::wireless_android_enterprise_devicemanagement::ApplicationSettings*
DMPolicyManager::GetAppSettings(const std::string& app_id) const { … }
std::optional<int> DMPolicyManager::GetEffectivePolicyForAppInstalls(
const std::string& app_id) const { … }
std::optional<int> DMPolicyManager::GetEffectivePolicyForAppUpdates(
const std::string& app_id) const { … }
std::optional<std::string> DMPolicyManager::GetTargetVersionPrefix(
const std::string& app_id) const { … }
std::optional<std::string> DMPolicyManager::GetTargetChannel(
const std::string& app_id) const { … }
std::optional<bool> DMPolicyManager::IsRollbackToTargetVersionAllowed(
const std::string& app_id) const { … }
std::optional<std::vector<std::string>> DMPolicyManager::GetForceInstallApps()
const { … }
std::optional<std::vector<std::string>> DMPolicyManager::GetAppsWithPolicy()
const { … }
std::optional<
wireless_android_enterprise_devicemanagement::OmahaSettingsClientProto>
GetOmahaPolicySettings(
scoped_refptr<device_management_storage::DMStorage> dm_storage) { … }
scoped_refptr<PolicyManagerInterface> CreateDMPolicyManager(
const std::optional<bool>& override_is_managed_device) { … }
}