chromium/chrome/browser/ui/views/extensions/extensions_menu_site_permissions_page_view.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/ui/views/extensions/extensions_menu_site_permissions_page_view.h"

#include <string>

#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/extensions/permissions/site_permissions_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/controls/hover_button.h"
#include "chrome/browser/ui/views/extensions/extensions_dialogs_utils.h"
#include "chrome/browser/ui/views/extensions/extensions_menu_handler.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.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/gfx/geometry/insets.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/button/radio_button.h"
#include "ui/views/controls/button/toggle_button.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/layout/flex_layout_view.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/metadata/view_factory_internal.h"
#include "ui/views/style/typography.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/view_utils.h"

namespace {

PermissionsManager;

// Radio buttons group id for site permissions.
constexpr int kSiteAccessButtonsId =;
// Indexes for each site permission radio button.
constexpr size_t kOnClickButtonIndex =;
constexpr size_t kOnSiteButtonIndex =;
constexpr size_t kOnAllSitesButtonIndex =;

// Returns the site access button in a site permissions `page`.
std::vector<views::RadioButton*> GetSiteAccessButtons(views::View* page) {}

std::u16string GetShowRequestsToggleAccessibleName(bool is_toggle_on) {}

// Returns the radio button text for `site_access` option.
std::u16string GetSiteAccessRadioButtonText(
    PermissionsManager::UserSiteAccess site_access,
    std::u16string current_site = std::u16string()) {}

// Returns the radio button description for `site_access` option.
std::u16string GetSiteAccessRadioButtonDescription(
    PermissionsManager::UserSiteAccess site_access) {}

// Returns the button index for `site_access`.
int GetSiteAccessButtonIndex(PermissionsManager::UserSiteAccess site_access) {}

// Returns the icon for the setting button.
std::unique_ptr<views::ImageView> GetSettingsButtonIcon(int icon_size) {}

}  // namespace

ExtensionsMenuSitePermissionsPageView::ExtensionsMenuSitePermissionsPageView(
    Browser* browser,
    extensions::ExtensionId extension_id,
    ExtensionsMenuHandler* menu_handler)
    :{}

void ExtensionsMenuSitePermissionsPageView::Update(
    const std::u16string& extension_name,
    const ui::ImageModel& extension_icon,
    const std::u16string& current_site,
    PermissionsManager::UserSiteAccess user_site_access,
    bool is_show_requests_toggle_on,
    bool is_on_site_enabled,
    bool is_on_all_sites_enabled) {}

void ExtensionsMenuSitePermissionsPageView::UpdateShowRequestsToggle(
    bool is_on) {}

views::RadioButton*
ExtensionsMenuSitePermissionsPageView::GetSiteAccessButtonForTesting(
    PermissionsManager::UserSiteAccess site_access) {}

BEGIN_METADATA()