#include "chrome/browser/ui/views/permissions/permission_prompt_bubble_one_origin_view.h"
#include <memory>
#include "base/containers/contains.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "chrome/browser/extensions/extension_ui_util.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/url_identity.h"
#include "chrome/browser/ui/views/bubble_anchor_util_views.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_widget_sublevel.h"
#include "chrome/browser/ui/views/title_origin_label.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/media_effects/media_device_info.h"
#include "components/permissions/features.h"
#include "components/permissions/permission_request.h"
#include "components/permissions/permission_uma_util.h"
#include "components/permissions/permission_util.h"
#include "components/permissions/request_type.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "components/vector_icons/vector_icons.h"
#include "extensions/common/constants.h"
#include "third_party/blink/public/common/features.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_id.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/text_constants.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/views_features.h"
#include "ui/views/widget/widget.h"
#if !BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/ui/views/media_preview/media_preview_feature.h"
#endif
namespace {
std::u16string GetAccessibleWindowTitleInternal(
const std::u16string display_name,
std::vector<raw_ptr<permissions::PermissionRequest, VectorExperimental>>
visible_requests) { … }
bool ShouldShowRequest(permissions::PermissionPrompt::Delegate& delegate,
permissions::RequestType type) { … }
std::vector<raw_ptr<permissions::PermissionRequest, VectorExperimental>>
GetVisibleRequests(permissions::PermissionPrompt::Delegate& delegate) { … }
std::optional<std::u16string> GetExtraText(
permissions::PermissionPrompt::Delegate& delegate) { … }
}
PermissionPromptBubbleOneOriginView::PermissionPromptBubbleOneOriginView(
Browser* browser,
base::WeakPtr<permissions::PermissionPrompt::Delegate> delegate,
base::TimeTicks permission_requested_time,
PermissionPromptStyle prompt_style)
: … { … }
PermissionPromptBubbleOneOriginView::~PermissionPromptBubbleOneOriginView() =
default;
void PermissionPromptBubbleOneOriginView::RunButtonCallback(int button_id) { … }
void PermissionPromptBubbleOneOriginView::AddRequestLine(
permissions::PermissionRequest* request,
std::size_t index) { … }
void PermissionPromptBubbleOneOriginView::MaybeAddMediaPreview(
std::vector<std::string> requested_audio_capture_device_ids,
std::vector<std::string> requested_video_capture_device_ids,
size_t index) { … }
#if !BUILDFLAG(IS_CHROMEOS)
void PermissionPromptBubbleOneOriginView::OnAudioDevicesChanged(
const std::optional<std::vector<media::AudioDeviceDescription>>&
device_infos) { … }
void PermissionPromptBubbleOneOriginView::OnVideoDevicesChanged(
const std::optional<std::vector<media::VideoCaptureDeviceInfo>>&
device_infos) { … }
#endif