chromium/chrome/browser/ui/webui/management/management_ui_handler.cc

// Copyright 2018 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/ui/webui/management/management_ui_handler.h"

#include <algorithm>
#include <memory>
#include <set>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>

#include "base/check_is_test.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/strings/escape.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/apps/app_service/app_icon_source.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/device_api/managed_configuration_api.h"
#include "chrome/browser/device_api/managed_configuration_api_factory.h"
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/enterprise/connectors/connectors_service.h"
#include "chrome/browser/enterprise/reporting/prefs.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 "chrome/browser/ui/managed_ui.h"
#include "chrome/browser/ui/webui/management/management_ui_constants.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_utils.h"
#include "chrome/common/pref_names.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/enterprise/browser/reporting/common_pref_names.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "components/policy/core/common/management/management_service.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/strings/grit/components_strings.h"
#include "components/supervised_user/core/common/pref_names.h"
#include "content/public/browser/web_contents.h"
#include "extensions/buildflags/buildflags.h"
#include "management_ui_handler.h"
#include "net/base/load_flags.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/referrer_policy.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
#include "chrome/browser/enterprise/signals/user_permission_service_factory.h"
#include "components/device_signals/core/browser/user_permission_service.h"  // nogncheck
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)

#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_service.h"
#include "components/policy/policy_constants.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permissions_data.h"

enum class ReportingType {};

namespace {

#if !BUILDFLAG(IS_CHROMEOS)

bool IsBrowserManaged() {}

#endif  // !BUILDFLAG(IS_CHROMEOS)

base::Value::List GetPermissionsForExtension(
    scoped_refptr<const extensions::Extension> extension) {}

base::Value::List GetPowerfulExtensions(
    const extensions::ExtensionSet& extensions) {}

const char* GetReportingTypeValue(ReportingType reportingType) {}

void AddThreatProtectionPermission(const char* title,
                                   const char* permission,
                                   base::Value::List* info) {}


}  // namespace

ManagementUIHandler::ManagementUIHandler(Profile* profile) {}

ManagementUIHandler::~ManagementUIHandler() {}

#if !BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<ManagementUIHandler> ManagementUIHandler::Create(
    Profile* profile) {}
#endif  //  !BUILDFLAG(IS_CHROMEOS)

void ManagementUIHandler::RegisterMessages() {}

void ManagementUIHandler::OnJavascriptAllowed() {}

void ManagementUIHandler::OnJavascriptDisallowed() {}

void ManagementUIHandler::AddReportingInfo(base::Value::List* report_sources,
                                           bool is_browser) {}

base::Value::Dict ManagementUIHandler::GetContextualManagedData(
    Profile* profile) {}

base::Value::Dict ManagementUIHandler::GetThreatProtectionInfo(
    Profile* profile) {}

base::Value::List ManagementUIHandler::GetManagedWebsitesInfo(
    Profile* profile) const {}

base::Value::List ManagementUIHandler::GetApplicationsInfo(
    Profile* profile) const {}

policy::PolicyService* ManagementUIHandler::GetPolicyService() {}

#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
device_signals::UserPermissionService*
ManagementUIHandler::GetUserPermissionService() {}
#endif  // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)

bool ManagementUIHandler::managed() const {}

void ManagementUIHandler::RegisterPrefChange(
    PrefChangeRegistrar& pref_registrar) {}

void ManagementUIHandler::UpdateManagedState() {}

bool ManagementUIHandler::UpdateAccountManagedState(Profile* profile) {}

#if !BUILDFLAG(IS_CHROMEOS)
bool ManagementUIHandler::UpdateBrowserManagedState() {}
#endif

std::string ManagementUIHandler::GetAccountManager(Profile* profile) const {}

bool ManagementUIHandler::IsProfileManaged(Profile* profile) const {}

void ManagementUIHandler::HandleGetExtensions(const base::Value::List& args) {}

void ManagementUIHandler::HandleGetContextualManagedData(
    const base::Value::List& args) {}

void ManagementUIHandler::HandleGetThreatProtectionInfo(
    const base::Value::List& args) {}

void ManagementUIHandler::HandleGetManagedWebsites(
    const base::Value::List& args) {}

void ManagementUIHandler::HandleGetApplications(const base::Value::List& args) {}

void ManagementUIHandler::HandleInitBrowserReportingInfo(
    const base::Value::List& args) {}

void ManagementUIHandler::HandleInitProfileReportingInfo(
    const base::Value::List& args) {}

void ManagementUIHandler::NotifyBrowserReportingInfoUpdated() {}

void ManagementUIHandler::NotifyProfileReportingInfoUpdated() {}

void ManagementUIHandler::NotifyThreatProtectionInfoUpdated() {}

void ManagementUIHandler::OnExtensionLoaded(
    content::BrowserContext* /*browser_context*/,
    const extensions::Extension* extension) {}

void ManagementUIHandler::OnExtensionUnloaded(
    content::BrowserContext* /*browser_context*/,
    const extensions::Extension* extension,
    extensions::UnloadedExtensionReason /*reason*/) {}

void ManagementUIHandler::OnPolicyUpdated(
    const policy::PolicyNamespace& /*ns*/,
    const policy::PolicyMap& /*previous*/,
    const policy::PolicyMap& /*current*/) {}

void ManagementUIHandler::AddObservers() {}

void ManagementUIHandler::RemoveObservers() {}