chromium/chrome/browser/policy/policy_value_and_status_aggregator.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/policy/policy_value_and_status_aggregator.h"

#include <memory>
#include <utility>

#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/policy/value_provider/chrome_policies_value_provider.h"
#include "chrome/browser/policy/value_provider/policy_value_provider.h"
#include "components/policy/core/browser/webui/policy_status_provider.h"
#include "components/policy/core/browser/webui/policy_webui_constants.h"
#include "components/policy/core/common/management/management_service.h"
#include "components/policy/core/common/policy_logger.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h"
#include "chrome/browser/ash/policy/core/device_local_account_policy_service.h"
#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/browser_process_platform_part_ash.h"
#include "chrome/browser/policy/status_provider/device_cloud_policy_status_provider_chromeos.h"
#include "chrome/browser/policy/status_provider/device_local_account_policy_status_provider.h"
#include "chrome/browser/policy/status_provider/user_cloud_policy_status_provider_chromeos.h"
#include "components/user_manager/user_manager.h"
#else
#include "chrome/browser/policy/status_provider/user_cloud_policy_status_provider.h"
#include "components/enterprise/browser/controller/browser_dm_token_storage.h"
#include "components/enterprise/browser/reporting/common_pref_names.h"
#include "components/policy/core/browser/webui/machine_level_user_cloud_policy_status_provider.h"
#include "components/policy/core/common/cloud/machine_level_user_cloud_policy_manager.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "components/prefs/pref_service.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/policy/status_provider/ash_lacros_policy_stack_bridge.h"
#include "chrome/browser/policy/status_provider/user_policy_status_provider_lacros.h"
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

#if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/policy/status_provider/updater_status_and_value_provider.h"
#endif  // BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)

#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/policy/value_provider/extension_policies_value_provider.h"
#endif  // BUILDFLAG(ENABLE_EXTENSIONS)

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
#include "components/policy/core/common/cloud/profile_cloud_policy_manager.h"
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)

namespace {
void AppendPolicyIdsToList(const base::Value::Dict& policy_values,
                           base::Value::List& policy_ids) {}

// Appends the ID of `policy_values` to `policy_ids` and merges it to
// `out_policy_values`.
void MergePolicyValuesAndIds(base::Value::Dict policy_values,
                             base::Value::Dict& out_policy_values,
                             base::Value::List& out_policy_ids) {}

// Returns the PolicyStatusProvider for user policies for the current platform.
std::unique_ptr<policy::PolicyStatusProvider> GetUserPolicyStatusProvider(
    Profile* profile) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
// Returns the PolicyStatusProvider for ChromeOS device policies.
std::unique_ptr<policy::PolicyStatusProvider>
GetChromeOSDevicePolicyStatusProvider(
    Profile* profile,
    policy::BrowserPolicyConnectorAsh* connector) {
  return std::make_unique<DeviceCloudPolicyStatusProviderChromeOS>(connector);
}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

#if !BUILDFLAG(IS_CHROMEOS_ASH)
// Returns policy status provider for machine policies for non-ChromeOS
// platforms.
std::unique_ptr<policy::PolicyStatusProvider> GetMachinePolicyStatusProvider(
    policy::MachineLevelUserCloudPolicyManager* manager) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace

namespace policy {

const char kUserStatusKey[] =;

#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
const char kDeviceStatusKey[] = "device";
#endif  // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)

#if !BUILDFLAG(IS_CHROMEOS_ASH)
constexpr char kMachineStatusKey[] =;
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
constexpr char kUpdaterStatusKey[] = "updater";
#endif  // BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)

std::unique_ptr<PolicyValueAndStatusAggregator>
PolicyValueAndStatusAggregator::CreateDefaultPolicyValueAndStatusAggregator(
    Profile* profile) {}

PolicyValueAndStatusAggregator::PolicyValueAndStatusAggregator() = default;
PolicyValueAndStatusAggregator::~PolicyValueAndStatusAggregator() = default;

base::Value::Dict PolicyValueAndStatusAggregator::GetAggregatedPolicyStatus() {}

base::Value::Dict PolicyValueAndStatusAggregator::GetAggregatedPolicyValues() {}

base::Value::Dict PolicyValueAndStatusAggregator::GetAggregatedPolicyNames() {}

void PolicyValueAndStatusAggregator::Refresh() {}

void PolicyValueAndStatusAggregator::AddObserver(Observer* observer) {}

void PolicyValueAndStatusAggregator::RemoveObserver(Observer* observer) {}

void PolicyValueAndStatusAggregator::OnPolicyValueChanged() {}

void PolicyValueAndStatusAggregator::OnPolicyStatusChanged() {}

void PolicyValueAndStatusAggregator::NotifyValueAndStatusChange() {}

void PolicyValueAndStatusAggregator::AddPolicyValueProvider(
    std::unique_ptr<PolicyValueProvider> value_provider) {}

void PolicyValueAndStatusAggregator::AddPolicyStatusProvider(
    std::string status_provider_description,
    std::unique_ptr<PolicyStatusProvider> status_provider) {}

void PolicyValueAndStatusAggregator::AddPolicyValueProviderUnowned(
    PolicyValueProvider* value_provider) {}

}  // namespace policy