chromium/chrome/browser/ui/views/permissions/embedded_permission_prompt.cc

// Copyright 2023 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/views/permissions/embedded_permission_prompt.h"

#include "base/memory/raw_ptr.h"
#include "chrome/browser/content_settings/chrome_content_settings_utils.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/media/webrtc/media_stream_device_permissions.h"
#include "chrome/browser/permissions/system/system_permission_settings.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_base_view.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_content_scrim_view.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_policy_view.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_denied_view.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_granted_view.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_show_system_prompt_view.h"
#include "chrome/browser/ui/views/permissions/embedded_permission_prompt_system_settings_view.h"
#include "chrome/common/pref_names.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/permissions/permission_uma_util.h"
#include "content/public/browser/web_contents.h"
#include "ui/color/color_id.h"

#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#include "chrome/browser/media/webrtc/system_media_capture_permissions_mac.h"
#endif

namespace {

SettingSource;

// An upper bound on the maximum number of screens that we can record in
// metrics. Practically speaking the actual number should never be more than 3
// but a higher bound allows us to detect via metrics if this happens in the
// wild.
constexpr int SCREEN_COUNTER_MAXIMUM =;

bool CanGroupVariants(EmbeddedPermissionPrompt::Variant a,
                      EmbeddedPermissionPrompt::Variant b) {}

bool IsPermissionSetByAdministator(ContentSetting setting,
                                   const content_settings::SettingInfo& info) {}

// TODO(41014586): Integrate policy-set media permissions into
// SettingsSource.policy. Currently, AudioCaptureAllowed, VideoCaptureAllowed
// are not checked within |IsPermissionSetByAdministrator|, so
// |IsPermissionBlockedByDevicePolicy| and |IsPermissionAllowedByDevicePolicy|
// methods are needed to show the appropriate policy screen.
bool IsPermissionBlockedByDevicePolicy(
    content::WebContents* web_contents,
    ContentSetting setting,
    const content_settings::SettingInfo& info,
    ContentSettingsType type) {}

bool IsPermissionAllowedByDevicePolicy(
    content::WebContents* web_contents,
    ContentSetting setting,
    const content_settings::SettingInfo& info,
    ContentSettingsType type) {}

permissions::ElementAnchoredBubbleVariant GetVariant(
    EmbeddedPermissionPrompt::Variant variant) {}
}  // namespace

EmbeddedPermissionPrompt::EmbeddedPermissionPrompt(
    Browser* browser,
    content::WebContents* web_contents,
    permissions::PermissionPrompt::Delegate* delegate)
    :{}

EmbeddedPermissionPrompt::~EmbeddedPermissionPrompt() {}

EmbeddedPermissionPrompt::Variant
EmbeddedPermissionPrompt::DeterminePromptVariant(
    ContentSetting setting,
    const content_settings::SettingInfo& info,
    ContentSettingsType type) {}

void EmbeddedPermissionPrompt::CloseCurrentViewAndMaybeShowNext(
    bool first_prompt) {}

EmbeddedPermissionPrompt::TabSwitchingBehavior
EmbeddedPermissionPrompt::GetTabSwitchingBehavior() {}

void EmbeddedPermissionPrompt::RecordOsMetrics(
    permissions::OsScreenAction action) {}

void EmbeddedPermissionPrompt::RecordPermissionActionUKM(
    permissions::ElementAnchoredBubbleAction action) {}

permissions::PermissionPromptDisposition
EmbeddedPermissionPrompt::GetPromptDisposition() const {}

bool EmbeddedPermissionPrompt::ShouldFinalizeRequestAfterDecided() const {}

void EmbeddedPermissionPrompt::PrecalculateVariantsForMetrics() {}

std::vector<permissions::ElementAnchoredBubbleVariant>
EmbeddedPermissionPrompt::GetPromptVariants() const {}

bool EmbeddedPermissionPrompt::IsAskPrompt() const {}

std::optional<permissions::feature_params::PermissionElementPromptPosition>
EmbeddedPermissionPrompt::GetPromptPosition() const {}

void EmbeddedPermissionPrompt::Allow() {}

void EmbeddedPermissionPrompt::AllowThisTime() {}

void EmbeddedPermissionPrompt::Dismiss() {}

void EmbeddedPermissionPrompt::Acknowledge() {}

void EmbeddedPermissionPrompt::StopAllowing() {}

void EmbeddedPermissionPrompt::ShowSystemSettings() {}

base::WeakPtr<permissions::PermissionPrompt::Delegate>
EmbeddedPermissionPrompt::GetPermissionPromptDelegate() const {}

const std::vector<raw_ptr<permissions::PermissionRequest, VectorExperimental>>&
EmbeddedPermissionPrompt::Requests() const {}

void EmbeddedPermissionPrompt::DismissScrim() {}

void EmbeddedPermissionPrompt::PromptForOsPermission() {}

void EmbeddedPermissionPrompt::OnRequestSystemPermissionResponse(
    const ContentSettingsType request_type,
    const ContentSettingsType other_request_type) {}

void EmbeddedPermissionPrompt::PrioritizeAndMergeNewVariant(
    EmbeddedPermissionPrompt::Variant new_variant,
    ContentSettingsType new_type) {}

void EmbeddedPermissionPrompt::RebuildRequests() {}

void EmbeddedPermissionPrompt::CloseView() {}

void EmbeddedPermissionPrompt::FinalizePrompt() {}

void EmbeddedPermissionPrompt::SendDelegateAction(Action action) {}