chromium/chrome/browser/ui/views/frame/browser_view.cc

// Copyright 2012 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/frame/browser_view.h"

#include <stdint.h>

#include <memory>
#include <set>
#include <utility>

#include "base/auto_reset.h"
#include "base/check.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/scoped_observation.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
#include "chrome/browser/enterprise/data_protection/data_protection_navigation_observer.h"
#include "chrome/browser/enterprise/watermark/watermark_view.h"
#include "chrome/browser/extensions/browser_extension_window_controller.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/headless/headless_mode_util.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/segmentation_platform/segmentation_platform_service_factory.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/sharing_hub/sharing_hub_features.h"
#include "chrome/browser/signin/chrome_signin_helper.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/ui/autofill/autofill_bubble_base.h"
#include "chrome/browser/ui/autofill/payments/save_card_ui.h"
#include "chrome/browser/ui/bookmarks/bookmark_stats.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/browser_window_state.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/performance_controls/memory_saver_opt_in_iph_controller.h"
#include "chrome/browser/ui/qrcode_generator/qrcode_generator_bubble_controller.h"
#include "chrome/browser/ui/recently_audible_helper.h"
#include "chrome/browser/ui/sad_tab_helper.h"
#include "chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller.h"
#include "chrome/browser/ui/sharing_hub/sharing_hub_bubble_view.h"
#include "chrome/browser/ui/side_search/side_search_utils.h"
#include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_menu_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
#include "chrome/browser/ui/toolbar/chrome_labs/chrome_labs_utils.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/accelerator_table.h"
#include "chrome/browser/ui/views/accessibility/accessibility_focus_highlight.h"
#include "chrome/browser/ui/views/accessibility/caret_browsing_dialog_delegate.h"
#include "chrome/browser/ui/views/autofill/autofill_bubble_handler_impl.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
#include "chrome/browser/ui/views/color_provider_browser_helper.h"
#include "chrome/browser/ui/views/download/bubble/download_toolbar_button_view.h"
#include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h"
#include "chrome/browser/ui/views/download/download_shelf_view.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_container.h"
#include "chrome/browser/ui/views/eye_dropper/eye_dropper.h"
#include "chrome/browser/ui/views/find_bar_host.h"
#include "chrome/browser/ui/views/frame/app_menu_button.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_view_layout.h"
#include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
#include "chrome/browser/ui/views/frame/contents_layout_manager.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/native_browser_frame.h"
#include "chrome/browser/ui/views/frame/tab_strip_region_view.h"
#include "chrome/browser/ui/views/frame/top_container_loading_bar.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
#include "chrome/browser/ui/views/frame/top_controls_slide_controller.h"
#include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h"
#include "chrome/browser/ui/views/global_media_controls/media_toolbar_button_view.h"
#include "chrome/browser/ui/views/hats/hats_next_web_dialog.h"
#include "chrome/browser/ui/views/incognito_clear_browsing_data_dialog_coordinator.h"
#include "chrome/browser/ui/views/infobars/infobar_container_view.h"
#include "chrome/browser/ui/views/location_bar/intent_chip_button.h"
#include "chrome/browser/ui/views/location_bar/intent_picker_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/location_bar/star_view.h"
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_controller.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h"
#include "chrome/browser/ui/views/profiles/profile_indicator_icon.h"
#include "chrome/browser/ui/views/profiles/profile_menu_coordinator.h"
#include "chrome/browser/ui/views/qrcode_generator/qrcode_generator_bubble.h"
#include "chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_bubble_view.h"
#include "chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_device_picker_bubble_view.h"
#include "chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_promo_bubble_view.h"
#include "chrome/browser/ui/views/sharing/sharing_dialog_view.h"
#include "chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.h"
#include "chrome/browser/ui/views/sharing_hub/sharing_hub_bubble_view_impl.h"
#include "chrome/browser/ui/views/sharing_hub/sharing_hub_icon_view.h"
#include "chrome/browser/ui/views/side_panel/side_panel.h"
#include "chrome/browser/ui/views/side_panel/side_panel_coordinator.h"
#include "chrome/browser/ui/views/side_panel/side_panel_registry.h"
#include "chrome/browser/ui/views/side_panel/side_panel_rounded_corner.h"
#include "chrome/browser/ui/views/side_panel/side_panel_ui.h"
#include "chrome/browser/ui/views/side_panel/side_panel_util.h"
#include "chrome/browser/ui/views/status_bubble_views.h"
#include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h"
#include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_focus_helper.h"
#include "chrome/browser/ui/views/tab_search_bubble_host.h"
#include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
#include "chrome/browser/ui/views/tabs/new_tab_button.h"
#include "chrome/browser/ui/views/tabs/tab.h"
#include "chrome/browser/ui/views/tabs/tab_search_button.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/theme_copying_widget.h"
#include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h"
#include "chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_button.h"
#include "chrome/browser/ui/views/toolbar/pinned_toolbar_actions_container.h"
#include "chrome/browser/ui/views/toolbar/reload_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/views/translate/translate_bubble_controller.h"
#include "chrome/browser/ui/views/translate/translate_bubble_view.h"
#include "chrome/browser/ui/views/update_recommended_message_box.h"
#include "chrome/browser/ui/views/upgrade_notification_controller.h"
#include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h"
#include "chrome/browser/ui/views/user_education/browser_user_education_service.h"
#include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_view.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/ui/webui/top_chrome/webui_contents_preload_manager.h"
#include "chrome/browser/ui/window_sizer/window_sizer.h"
#include "chrome/browser/user_education/user_education_service.h"
#include "chrome/browser/user_education/user_education_service_factory.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "chromeos/components/mgs/managed_guest_session_utils.h"
#include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/content_settings/core/common/features.h"
#include "components/enterprise/buildflags/buildflags.h"
#include "components/feature_engagement/public/event_constants.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/javascript_dialogs/app_modal_dialog_controller.h"
#include "components/javascript_dialogs/app_modal_dialog_queue.h"
#include "components/javascript_dialogs/app_modal_dialog_view.h"
#include "components/omnibox/browser/omnibox_popup_view.h"
#include "components/omnibox/browser/omnibox_view.h"
#include "components/performance_manager/public/features.h"
#include "components/permissions/permission_request_manager.h"
#include "components/prefs/pref_service.h"
#include "components/reading_list/core/reading_list_pref_names.h"
#include "components/safe_browsing/core/browser/password_protection/metrics_util.h"
#include "components/segmentation_platform/embedder/default_model/device_switcher_model.h"
#include "components/segmentation_platform/public/constants.h"
#include "components/segmentation_platform/public/input_context.h"
#include "components/segmentation_platform/public/prediction_options.h"
#include "components/segmentation_platform/public/segmentation_platform_service.h"
#include "components/sessions/core/tab_restore_service.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "components/sync/service/sync_service.h"
#include "components/translate/core/browser/language_state.h"
#include "components/translate/core/browser/translate_manager.h"
#include "components/user_education/common/feature_promo_handle.h"
#include "components/user_education/common/help_bubble_factory_registry.h"
#include "components/user_education/common/new_badge_controller.h"
#include "components/user_education/common/user_education_features.h"
#include "components/user_education/views/help_bubble_view.h"
#include "components/version_info/channel.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/webapps/browser/banners/app_banner_manager.h"
#include "components/webapps/browser/banners/installable_web_app_check_result.h"
#include "components/webapps/browser/banners/web_app_banner_data.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/permission_controller.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "extensions/common/command.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_mode_observer.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/platform/ax_platform.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/hit_test.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/text/bytes_formatting.h"
#include "ui/base/theme_provider.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/window_open_disposition.h"
#include "ui/base/window_open_disposition_utils.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/paint_recorder.h"
#include "ui/content_accelerators/accelerator_util.h"
#include "ui/display/screen.h"
#include "ui/events/event_utils.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/gfx/scrollbar_size.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/accessibility/view_accessibility_utils.h"
#include "ui/views/background.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/separator.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/focus/external_focus_tracker.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/views_features.h"
#include "ui/views/widget/native_widget.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/sublevel_manager.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"

#if BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.h"
#include "chrome/browser/ui/views/frame/top_controls_slide_controller_chromeos.h"
#include "chromeos/ui/frame/caption_buttons/frame_size_button.h"
#include "chromeos/ui/wm/desks/desks_helper.h"
#else
#include "chrome/browser/ui/views/enterprise/managed_menu_coordinator.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_switches.h"
#include "ash/public/cpp/accelerators.h"
#include "ash/public/cpp/metrics_util.h"
#include "ash/wm/window_properties.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/grit/chrome_unscaled_resources.h"
#include "ui/compositor/throughput_tracker.h"
#else
#include "chrome/browser/ui/signin/signin_view_controller.h"
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

#if BUILDFLAG(IS_MAC)
#include "chrome/browser/global_keyboard_shortcuts_mac.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/fullscreen_util_mac.h"
#include "components/remote_cocoa/app_shim/application_bridge.h"
#include "components/remote_cocoa/browser/application_host.h"
#endif

#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/promos/promos_types.h"
#include "chrome/browser/promos/promos_utils.h"
#include "chrome/browser/ui/views/promos/ios_promo_bubble.h"
#include "chrome/browser/ui/views/promos/ios_promo_password_bubble.h"
#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)

#if defined(USE_AURA)
#include "chrome/browser/ui/views/theme_profile_key.h"
#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#endif

#if BUILDFLAG(IS_WIN)
#include "chrome/browser/taskbar/taskbar_decorator_win.h"
#include "chrome/browser/win/jumplist.h"
#include "chrome/browser/win/jumplist_factory.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/win/hwnd_util.h"
#include "ui/native_theme/native_theme_win.h"
#include "ui/views/win/scoped_fullscreen_visibility.h"

// To avoid conflicts with the macro from the Windows SDK...
#undef LoadAccelerators
#endif

#if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
#include "chrome/browser/ui/views/frame/webui_tab_strip_container_view.h"
#endif  // BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)

UserMetricsAction;
WebContents;
NativeWebKeyboardEvent;
WebContentsModalDialogHost;

namespace {

// When enabled, changes the frame rate of the loading tab spinner to
// 1 / kLoadingTabAnimationFrameDelay. In practice the goal is to reduce the
// frame rate (increase kLoadingTabAnimationFrameDelay) to improve performance,
// while still keeping a reasonable experience. Details in crbug.com/355000380.
// The default rate is 1/0.03 ~= 33fps.
BASE_FEATURE();
constexpr base::FeatureParam<base::TimeDelta> kLoadingTabAnimationFrameDelay =;

// The name of a key to store on the window handle so that other code can
// locate this object using just the handle.
const char* const kBrowserViewKey =;

#if BUILDFLAG(IS_CHROMEOS_ASH)
// UMA histograms that record animation smoothness for tab loading animation.
constexpr char kTabLoadingSmoothnessHistogramName[] =
    "Chrome.Tabs.AnimationSmoothness.TabLoading";

void RecordTabLoadingSmoothness(int smoothness) {
  UMA_HISTOGRAM_PERCENTAGE(kTabLoadingSmoothnessHistogramName, smoothness);
}
#endif

// See SetDisableRevealerDelayForTesting().
bool g_disable_revealer_delay_for_testing =;

#if DCHECK_IS_ON()

std::string FocusListToString(views::View* view) {}

void CheckFocusListForCycles(views::View* const start_view) {}

#endif  // DCHECK_IS_ON()

bool GetGestureCommand(ui::GestureEvent* event, int* command) {}

bool WidgetHasChildModalDialog(views::Widget* parent_widget) {}

#if BUILDFLAG(IS_CHROMEOS)
// Returns whether immmersive fullscreen should replace fullscreen. This
// should only occur for "browser-fullscreen" for tabbed-typed windows (not
// for tab-fullscreen and not for app/popup type windows).
bool ShouldUseImmersiveFullscreenForUrl(const GURL& url) {
  // Kiosk mode needs the whole screen.
  if (IsRunningInAppMode()) {
    return false;
  }
  // An empty URL signifies browser fullscreen. Immersive is used for browser
  // fullscreen only.
  return url.is_empty();
}
#endif

// Overlay view that owns TopContainerView in some cases (such as during
// immersive fullscreen reveal).
class TopContainerOverlayView : public views::View {};

BEGIN_METADATA()

// A view targeter for the overlay view, which makes sure the overlay view
// itself is never a target for events, but its children (i.e. top_container)
// may be.
class OverlayViewTargeterDelegate : public views::ViewTargeterDelegate {};

// This class uses a solid background instead of a views::Separator. The latter
// is not guaranteed to fill its bounds and assumes being painted on an opaque
// background (which is why it'd be OK to only partially fill its bounds). This
// needs to fill its bounds to have the entire BrowserView painted.
class ContentsSeparator : public views::View {};

BEGIN_METADATA()

bool ShouldShowWindowIcon(const Browser* browser,
                          bool app_uses_window_controls_overlay) {}

#if BUILDFLAG(IS_MAC)
void GetAnyTabAudioStates(const Browser* browser,
                          bool* any_tab_playing_audio,
                          bool* any_tab_playing_muted_audio) {
  const TabStripModel* model = browser->tab_strip_model();
  for (int i = 0; i < model->count(); i++) {
    auto* contents = model->GetWebContentsAt(i);
    auto* helper = RecentlyAudibleHelper::FromWebContents(contents);
    if (helper && helper->WasRecentlyAudible()) {
      if (contents->IsAudioMuted())
        *any_tab_playing_muted_audio = true;
      else
        *any_tab_playing_audio = true;
    }
  }
}
#endif  // BUILDFLAG(IS_MAC)

#if BUILDFLAG(IS_MAC)
// OverlayWidget is a child Widget of BrowserFrame used during immersive
// fullscreen on macOS that hosts the top container. Its native Window and View
// interface with macOS fullscreen APIs allowing separation of the top container
// and web contents.
// Currently the only explicit reason for OverlayWidget to be its own subclass
// is to support GetAccelerator() forwarding.
class OverlayWidget : public ThemeCopyingWidget {
 public:
  explicit OverlayWidget(views::Widget* role_model)
      : ThemeCopyingWidget(role_model) {}

  OverlayWidget(const OverlayWidget&) = delete;
  OverlayWidget& operator=(const OverlayWidget&) = delete;

  ~OverlayWidget() override = default;

  // OverlayWidget hosts the top container. Views within the top container look
  // up accelerators by asking their hosting Widget. In non-immersive fullscreen
  // that would be the BrowserFrame. Give top chrome what it expects and forward
  // GetAccelerator() calls to OverlayWidget's parent (BrowserFrame).
  bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) const override {
    DCHECK(parent());
    return parent()->GetAccelerator(cmd_id, accelerator);
  }

  // Instances of OverlayWidget do not activate directly but their views style
  // should follow the parent (browser frame) activation state. In other words,
  // when the browser frame is not activate the overlay widget views will
  // appear disabled.
  bool ShouldViewsStyleFollowWidgetActivation() const override { return true; }
};

// TabContainerOverlayView is a view that hosts the TabStripRegionView during
// immersive fullscreen. The TopContainerView usually draws the background for
// the tab strip. Since the tab strip has been reparented we need to handle
// drawing the background here.
class TabContainerOverlayView : public views::View {
  METADATA_HEADER(TabContainerOverlayView, views::View)

 public:
  explicit TabContainerOverlayView(base::WeakPtr<BrowserView> browser_view)
      : browser_view_(std::move(browser_view)) {}
  ~TabContainerOverlayView() override = default;

  // views::View override
  void OnPaintBackground(gfx::Canvas* canvas) override {
    SkColor frame_color = browser_view_->frame()->GetFrameView()->GetFrameColor(
        BrowserFrameActiveState::kUseCurrent);
    canvas->DrawColor(frame_color);

    auto* theme_service =
        ThemeServiceFactory::GetForProfile(browser_view_->browser()->profile());
    if (!theme_service->UsingSystemTheme()) {
      auto* non_client_frame_view = browser_view_->frame()->GetFrameView();
      non_client_frame_view->PaintThemedFrame(canvas);
    }
  }

 private:
  // The BrowserView this overlay is created for. WeakPtr is used since
  // this view is held in a different hierarchy.
  base::WeakPtr<BrowserView> browser_view_;
};

BEGIN_METADATA(TabContainerOverlayView)
END_METADATA

#else  // !BUILDFLAG(IS_MAC)

// Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste on
// the given WebContents, returning true if it consumed the event.
bool DoCutCopyPasteForWebContents(content::WebContents* contents,
                                  void (content::WebContents::*method)()) {}

#endif  // BUILDFLAG(IS_MAC)

}  // namespace

///////////////////////////////////////////////////////////////////////////////
// Delegate implementation for BrowserViewLayout. Usually just forwards calls
// into BrowserView.
class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {};

///////////////////////////////////////////////////////////////////////////////
// BrowserView::AccessibilityModeObserver:

class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {};

///////////////////////////////////////////////////////////////////////////////
// BrowserView, public:

BrowserView::BrowserView(std::unique_ptr<Browser> browser)
    :{}

void BrowserView::ToggleCompactModeUI() {}

BrowserView::~BrowserView() {}

// static
BrowserWindow* BrowserWindow::FindBrowserWindowWithWebContents(
    content::WebContents* web_contents) {}

// static
BrowserView* BrowserView::GetBrowserViewForNativeWindow(
    gfx::NativeWindow window) {}

// static
BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) {}

void BrowserView::SetDownloadShelfForTest(DownloadShelf* download_shelf) {}

// static
void BrowserView::SetDisableRevealerDelayForTesting(bool disable) {}

gfx::Rect BrowserView::GetFindBarBoundingBox() const {}

int BrowserView::GetTabStripHeight() const {}

gfx::Size BrowserView::GetWebAppFrameToolbarPreferredSize() const {}

#if BUILDFLAG(IS_MAC)
bool BrowserView::UsesImmersiveFullscreenMode() const {
  const bool is_pwa =
      base::FeatureList::IsEnabled(features::kImmersiveFullscreenPWAs) &&
      GetIsWebAppType();
  const bool is_tabbed_window = GetSupportsTabStrip();
  return base::FeatureList::IsEnabled(features::kImmersiveFullscreen) &&
         (is_pwa || is_tabbed_window);
}

bool BrowserView::UsesImmersiveFullscreenTabbedMode() const {
  return (GetSupportsTabStrip() &&
          base::FeatureList::IsEnabled(features::kImmersiveFullscreen) &&
          base::FeatureList::IsEnabled(features::kImmersiveFullscreenTabs)) &&
         !GetIsWebAppType();
}
#endif

TabSearchBubbleHost* BrowserView::GetTabSearchBubbleHost() {}

bool BrowserView::GetTabStripVisible() const {}

bool BrowserView::ShouldDrawTabStrip() const {}

bool BrowserView::GetIncognito() const {}

bool BrowserView::GetGuestSession() const {}

bool BrowserView::GetRegularOrGuestSession() const {}

bool BrowserView::GetAccelerator(int cmd_id,
                                 ui::Accelerator* accelerator) const {}

bool BrowserView::IsAcceleratorRegistered(const ui::Accelerator& accelerator) {}

WebContents* BrowserView::GetActiveWebContents() {}

bool BrowserView::GetSupportsTabStrip() const {}

bool BrowserView::GetIsNormalType() const {}

bool BrowserView::GetIsWebAppType() const {}

bool BrowserView::GetIsPictureInPictureType() const {}

std::optional<blink::mojom::PictureInPictureWindowOptions>
BrowserView::GetDocumentPictureInPictureOptions() const {}

bool BrowserView::GetTopControlsSlideBehaviorEnabled() const {}

float BrowserView::GetTopControlsSlideBehaviorShownRatio() const {}

views::Widget* BrowserView::GetWidgetForAnchoring() {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, BrowserWindow implementation:

void BrowserView::Show() {}

void BrowserView::ShowInactive() {}

void BrowserView::Hide() {}

bool BrowserView::IsVisible() const {}

bool BrowserView::CanSetBounds(const gfx::Rect& new_bounds) {}

void BrowserView::SetBounds(const gfx::Rect& bounds) {}

void BrowserView::Close() {}

void BrowserView::Activate() {}

void BrowserView::Deactivate() {}

bool BrowserView::IsActive() const {}

void BrowserView::FlashFrame(bool flash) {}

ui::ZOrderLevel BrowserView::GetZOrderLevel() const {}

void BrowserView::SetZOrderLevel(ui::ZOrderLevel level) {}

gfx::NativeWindow BrowserView::GetNativeWindow() const {}

bool BrowserView::IsOnCurrentWorkspace() const {}

void BrowserView::SetTopControlsShownRatio(content::WebContents* web_contents,
                                           float ratio) {}

bool BrowserView::DoBrowserControlsShrinkRendererSize(
    const content::WebContents* contents) const {}

ui::NativeTheme* BrowserView::GetNativeTheme() {}

const ui::ThemeProvider* BrowserView::GetThemeProvider() const {}

const ui::ColorProvider* BrowserView::GetColorProvider() const {}

ui::ElementContext BrowserView::GetElementContext() {}

int BrowserView::GetTopControlsHeight() const {}

void BrowserView::SetTopControlsGestureScrollInProgress(bool in_progress) {}

StatusBubble* BrowserView::GetStatusBubble() {}

void BrowserView::UpdateTitleBar() {}

void BrowserView::BookmarkBarStateChanged(
    BookmarkBar::AnimateChangeType change_type) {}

void BrowserView::TemporarilyShowBookmarkBar(base::TimeDelta duration) {}

void BrowserView::UpdateDevTools() {}

void BrowserView::UpdateLoadingAnimations(bool is_visible) {}

void BrowserView::SetLoadingAnimationStateChangeClosureForTesting(
    base::OnceClosure closure) {}

gfx::Point BrowserView::GetThemeOffsetFromBrowserView() const {}

// static:
BrowserView::DevToolsDockedPlacement BrowserView::GetDevToolsDockedPlacement(
    const gfx::Rect& contents_webview_bounds,
    const gfx::Rect& local_webview_container_bounds) {}

bool BrowserView::IsLoadingAnimationRunningForTesting() const {}

void BrowserView::SetStarredState(bool is_starred) {}

void BrowserView::SetTranslateIconToggled(bool is_lit) {}

void BrowserView::OnActiveTabChanged(content::WebContents* old_contents,
                                     content::WebContents* new_contents,
                                     int index,
                                     int reason) {}

void BrowserView::OnTabDetached(content::WebContents* contents,
                                bool was_active) {}

void BrowserView::ZoomChangedForActiveTab(bool can_show_bubble) {}

gfx::Rect BrowserView::GetRestoredBounds() const {}

ui::WindowShowState BrowserView::GetRestoredState() const {}

gfx::Rect BrowserView::GetBounds() const {}

gfx::Size BrowserView::GetContentsSize() const {}

void BrowserView::SetContentsSize(const gfx::Size& size) {}

bool BrowserView::IsMaximized() const {}

bool BrowserView::IsMinimized() const {}

void BrowserView::Maximize() {}

void BrowserView::Minimize() {}

void BrowserView::Restore() {}

void BrowserView::EnterFullscreen(const GURL& url,
                                  ExclusiveAccessBubbleType bubble_type,
                                  const int64_t display_id) {}

void BrowserView::ExitFullscreen() {}

void BrowserView::UpdateExclusiveAccessBubble(
    const ExclusiveAccessBubbleParams& params,
    ExclusiveAccessBubbleHideCallback first_hide_callback) {}

bool BrowserView::IsExclusiveAccessBubbleDisplayed() const {}

void BrowserView::OnExclusiveAccessUserInput() {}

bool BrowserView::ShouldHideUIForFullscreen() const {}

bool BrowserView::IsFullscreen() const {}

bool BrowserView::IsFullscreenBubbleVisible() const {}

bool BrowserView::IsForceFullscreen() const {}

void BrowserView::SetForceFullscreen(bool force_fullscreen) {}

void BrowserView::RestoreFocus() {}

void BrowserView::FullscreenStateChanging() {}

void BrowserView::FullscreenStateChanged() {}

void BrowserView::SetToolbarButtonProvider(ToolbarButtonProvider* provider) {}

void BrowserView::UpdatePageActionIcon(PageActionIconType type) {}

autofill::AutofillBubbleHandler* BrowserView::GetAutofillBubbleHandler() {}

void BrowserView::ExecutePageActionIconForTesting(PageActionIconType type) {}

LocationBar* BrowserView::GetLocationBar() const {}

void BrowserView::SetFocusToLocationBar(bool is_user_initiated) {}

void BrowserView::UpdateReloadStopState(bool is_loading, bool force) {}

void BrowserView::UpdateToolbar(content::WebContents* contents) {}

bool BrowserView::UpdateToolbarSecurityState() {}

void BrowserView::UpdateCustomTabBarVisibility(bool visible, bool animate) {}

void BrowserView::ResetToolbarTabState(content::WebContents* contents) {}

void BrowserView::FocusToolbar() {}

ExtensionsContainer* BrowserView::GetExtensionsContainer() {}

void BrowserView::ToolbarSizeChanged(bool is_animating) {}

void BrowserView::TabDraggingStatusChanged(bool is_dragging) {}

base::CallbackListSubscription BrowserView::AddOnLinkOpeningFromGestureCallback(
    OnLinkOpeningFromGestureCallback callback) {}

void BrowserView::LinkOpeningFromGesture(WindowOpenDisposition disposition) {}

bool BrowserView::AppUsesWindowControlsOverlay() const {}

bool BrowserView::IsWindowControlsOverlayEnabled() const {}

void BrowserView::UpdateWindowControlsOverlayEnabled() {}

void BrowserView::UpdateWindowControlsOverlayToggleVisible() {}

void BrowserView::UpdateBorderlessModeEnabled() {}

void BrowserView::UpdateWindowManagementPermission(
    blink::mojom::PermissionStatus status) {}

void BrowserView::SetWindowManagementPermissionSubscriptionForBorderlessMode(
    content::WebContents* web_contents) {}

void BrowserView::ToggleWindowControlsOverlayEnabled(base::OnceClosure done) {}

bool BrowserView::WidgetOwnedByAnchorContainsPoint(
    const gfx::Point& point_in_browser_view_coords) {}

bool BrowserView::IsBorderlessModeEnabled() const {}
void BrowserView::ShowChromeLabs() {}

views::WebView* BrowserView::GetContentsWebView() {}

BrowserView* BrowserView::AsBrowserView() {}

bool BrowserView::AppUsesBorderlessMode() const {}

bool BrowserView::AreDraggableRegionsEnabled() const {}

void BrowserView::UpdateSidePanelHorizontalAlignment() {}

void BrowserView::FocusBookmarksToolbar() {}

void BrowserView::FocusInactivePopupForAccessibility() {}

void BrowserView::FocusAppMenu() {}

void BrowserView::RotatePaneFocus(bool forwards) {}

void BrowserView::FocusWebContentsPane() {}

bool BrowserView::ActivateFirstInactiveBubbleForAccessibility() {}

void BrowserView::TryNotifyWindowBoundsChanged(const gfx::Rect& widget_bounds) {}

void BrowserView::OnWidgetVisibilityChanged(views::Widget* widget,
                                            bool visible) {}

std::optional<bool> BrowserView::GetCanResizeFromWebAPI() const {}

bool BrowserView::GetCanResize() {}

// TODO(laurila, crbug.com/1466855): Map into new `ui::DisplayState` enum
// instead of `ui::WindowShowState`.
ui::WindowShowState BrowserView::GetWindowShowState() const {}

void BrowserView::OnCanResizeFromWebAPIChanged() {}

void BrowserView::SynchronizeRenderWidgetHostVisualPropertiesForMainFrame() {}

void BrowserView::NotifyWidgetSizeConstraintsChanged() {}

void BrowserView::OnWidgetShowStateChanged(views::Widget* widget) {}

void BrowserView::DidFirstVisuallyNonEmptyPaint() {}

void BrowserView::TouchModeChanged() {}

void BrowserView::MaybeShowWebUITabStripIPH() {}

void BrowserView::MaybeShowReadingListInSidePanelIPH() {}

void BrowserView::MaybeShowExperimentalAIIPH() {}

void BrowserView::DestroyBrowser() {}

bool BrowserView::IsBookmarkBarVisible() const {}

bool BrowserView::IsBookmarkBarAnimating() const {}

bool BrowserView::IsTabStripEditable() const {}

bool BrowserView::IsToolbarVisible() const {}

bool BrowserView::IsToolbarShowing() const {}

bool BrowserView::IsLocationBarVisible() const {}

void BrowserView::ShowUpdateChromeDialog() {}

void BrowserView::ShowIntentPickerBubble(
    std::vector<IntentPickerBubbleView::AppInfo> app_info,
    bool show_stay_in_chrome,
    bool show_remember_selection,
    apps::IntentPickerBubbleType bubble_type,
    const std::optional<url::Origin>& initiating_origin,
    IntentPickerResponse callback) {}

void BrowserView::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {}

#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
void BrowserView::VerifyUserEligibilityIOSPasswordPromoBubble() {
  if (!browser_) {
    return;
  }

  const syncer::SyncService* sync_service =
      SyncServiceFactory::GetForProfile(browser_->profile());

  // Verify that the user is currently syncing their preferences, hasn't
  // exceeded their impression limit, is not in the cooldown period or has not
  // opted-out from seeing the promo.
  if (sync_service && sync_service->IsSyncFeatureActive() &&
      sync_service->GetActiveDataTypes().Has(syncer::PREFERENCES) &&
      promos_utils::ShouldShowIOSPasswordPromo(browser_->profile())) {
    auto input_context =
        base::MakeRefCounted<segmentation_platform::InputContext>();
    input_context->metadata_args.emplace(
        "active_days_limit", promos_utils::kiOSPasswordPromoLookbackWindow);
    input_context->metadata_args.emplace(
        "wait_for_device_info_in_seconds",
        segmentation_platform::processing::ProcessedValue(0));

    segmentation_platform::PredictionOptions options;
    options.on_demand_execution = true;

    // Get segmentation platform classification results and pass callback.
    segmentation_platform::SegmentationPlatformServiceFactory::GetForProfile(
        browser_->profile())
        ->GetClassificationResult(
            segmentation_platform::kDeviceSwitcherKey, options, input_context,
            base::BindOnce(&BrowserView::MaybeShowIOSPasswordPromoBubble,
                           GetAsWeakPtr()));
  }
}

void BrowserView::MaybeShowIOSPasswordPromoBubble(
    const segmentation_platform::ClassificationResult& result) {
  if (!browser_) {
    return;
  }

  feature_engagement::Tracker* tracker =
      feature_engagement::TrackerFactory::GetForBrowserContext(
          browser_->profile());

  if (promos_utils::UserNotClassifiedAsMobileDeviceSwitcher(result) &&
      tracker->ShouldTriggerHelpUI(
          feature_engagement::kIPHiOSPasswordPromoDesktopFeature)) {
    promos_utils::iOSPasswordPromoShown(browser_->profile());
    ShowIOSPasswordPromoBubble();
  }
}

void BrowserView::ShowIOSPasswordPromoBubble() {
  if (!browser_) {
    return;
  }

  ToolbarButtonProvider* button_provider =
      BrowserView::GetBrowserViewForBrowser(browser_.get())
          ->toolbar_button_provider();
  if (base::FeatureList::IsEnabled(
          features::kIOSPromoRefreshedPasswordBubble)) {
    IOSPromoBubble::ShowPromoBubble(
        button_provider->GetAnchorView(PageActionIconType::kManagePasswords),
        button_provider->GetPageActionIconView(
            PageActionIconType::kManagePasswords),
        browser_.get(), IOSPromoType::kPassword);
  } else {
    IOSPromoPasswordBubble::ShowBubble(
        button_provider->GetAnchorView(PageActionIconType::kManagePasswords),
        button_provider->GetPageActionIconView(
            PageActionIconType::kManagePasswords),
        browser_.get());
  }
}
#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)

qrcode_generator::QRCodeGeneratorBubbleView*
BrowserView::ShowQRCodeGeneratorBubble(content::WebContents* contents,
                                       const GURL& url,
                                       bool show_back_button) {}

sharing_hub::ScreenshotCapturedBubble*
BrowserView::ShowScreenshotCapturedBubble(content::WebContents* contents,
                                          const gfx::Image& image) {}

SharingDialog* BrowserView::ShowSharingDialog(
    content::WebContents* web_contents,
    SharingDialogData data) {}

send_tab_to_self::SendTabToSelfBubbleView*
BrowserView::ShowSendTabToSelfDevicePickerBubble(
    content::WebContents* web_contents) {}

send_tab_to_self::SendTabToSelfBubbleView*
BrowserView::ShowSendTabToSelfPromoBubble(content::WebContents* web_contents,
                                          bool show_signin_button) {}

#if BUILDFLAG(IS_CHROMEOS)
views::Button* BrowserView::GetSharingHubIconButton() {
  return toolbar_button_provider()->GetPageActionIconView(
      PageActionIconType::kSharingHub);
}

void BrowserView::ToggleMultitaskMenu() const {
  auto* frame_view =
      static_cast<BrowserNonClientFrameViewChromeOS*>(frame_->GetFrameView());
  if (!frame_view) {
    return;
  }
  auto* size_button = static_cast<chromeos::FrameSizeButton*>(
      frame_view->caption_button_container()->size_button());
  if (size_button && size_button->GetVisible()) {
    size_button->ToggleMultitaskMenu();
  }
}
#else
sharing_hub::SharingHubBubbleView* BrowserView::ShowSharingHubBubble(
    share::ShareAttempt attempt) {}
#endif  // BUILDFLAG(IS_CHROMEOS)

ShowTranslateBubbleResult BrowserView::ShowTranslateBubble(
    content::WebContents* web_contents,
    translate::TranslateStep step,
    const std::string& source_language,
    const std::string& target_language,
    translate::TranslateErrors error_type,
    bool is_user_gesture) {}

void BrowserView::StartPartialTranslate(const std::string& source_language,
                                        const std::string& target_language,
                                        const std::u16string& text_selection) {}

void BrowserView::ShowOneClickSigninConfirmation(
    const std::u16string& email,
    base::OnceCallback<void(bool)> confirmed_callback) {}

void BrowserView::SetDownloadShelfVisible(bool visible) {}

bool BrowserView::IsDownloadShelfVisible() const {}

DownloadShelf* BrowserView::GetDownloadShelf() {}

views::View* BrowserView::GetTopContainer() {}

DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {}

void BrowserView::ConfirmBrowserCloseWithPendingDownloads(
    int download_count,
    Browser::DownloadCloseType dialog_type,
    base::OnceCallback<void(bool)> callback) {}

void BrowserView::UserChangedTheme(BrowserThemeChangeType theme_change_type) {}

void BrowserView::ShowAppMenu() {}

content::KeyboardEventProcessingResult BrowserView::PreHandleKeyboardEvent(
    const NativeWebKeyboardEvent& event) {}

bool BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}

#if BUILDFLAG(IS_MAC)
namespace {
remote_cocoa::mojom::CutCopyPasteCommand CommandFromBrowserCommand(
    int command_id) {
  if (command_id == IDC_CUT) {
    return remote_cocoa::mojom::CutCopyPasteCommand::kCut;
  }
  if (command_id == IDC_COPY) {
    return remote_cocoa::mojom::CutCopyPasteCommand::kCopy;
  }
  CHECK_EQ(command_id, IDC_PASTE);
  return remote_cocoa::mojom::CutCopyPasteCommand::kPaste;
}
}  // namespace
#endif

void BrowserView::Cut() {}
void BrowserView::Copy() {}
void BrowserView::Paste() {}

// TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always
// enabled in the page menu regardless of whether the command will do
// anything. When someone selects the menu item, we just act as if they hit
// the keyboard shortcut for the command by sending the associated key press
// to windows. The real fix to this bug is to disable the commands when they
// won't do anything. We'll need something like an overall clipboard command
// manager to do that.
void BrowserView::CutCopyPaste(int command_id) {}

std::unique_ptr<FindBar> BrowserView::CreateFindBar() {}

WebContentsModalDialogHost* BrowserView::GetWebContentsModalDialogHost() {}

BookmarkBarView* BrowserView::GetBookmarkBarView() const {}

LocationBarView* BrowserView::GetLocationBarView() const {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, TabStripModelObserver implementation:

void BrowserView::OnTabStripModelChanged(
    TabStripModel* tab_strip_model,
    const TabStripModelChange& change,
    const TabStripSelectionChange& selection) {}

void BrowserView::TabStripEmpty() {}

void BrowserView::WillCloseAllTabs(TabStripModel* tab_strip_model) {}

void BrowserView::CloseAllTabsStopped(TabStripModel* tab_strip_model,
                                      CloseAllStoppedReason reason) {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, ui::AcceleratorProvider implementation:

bool BrowserView::GetAcceleratorForCommandId(
    int command_id,
    ui::Accelerator* accelerator) const {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, views::WidgetDelegate implementation:

bool BrowserView::CanResize() const {}

bool BrowserView::CanFullscreen() const {}

bool BrowserView::CanMaximize() const {}

bool BrowserView::CanActivate() const {}

std::u16string BrowserView::GetWindowTitle() const {}

std::u16string BrowserView::GetAccessibleWindowTitle() const {}

std::u16string BrowserView::GetAccessibleWindowTitleForChannelAndProfile(
    version_info::Channel channel,
    Profile* profile) const {}

std::u16string BrowserView::GetAccessibleTabLabel(int index,
                                                  bool is_for_tab) const {}

std::vector<views::NativeViewHost*>
BrowserView::GetNativeViewHostsForTopControlsSlide() const {}

void BrowserView::ReparentTopContainerForEndOfImmersive() {}

void BrowserView::EnsureFocusOrder() {}

bool BrowserView::CanChangeWindowIcon() const {}

views::View* BrowserView::GetInitiallyFocusedView() {}

#if BUILDFLAG(IS_WIN)
bool BrowserView::GetSupportsTitle() const {
  return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR) ||
         WebUITabStripContainerView::SupportsTouchableTabStrip(browser());
}

bool BrowserView::GetSupportsIcon() const {
  return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
}
#endif

bool BrowserView::ShouldShowWindowTitle() const {}

bool BrowserView::ShouldShowWindowIcon() const {}

ui::ImageModel BrowserView::GetWindowAppIcon() {}

ui::ImageModel BrowserView::GetWindowIcon() {}

bool BrowserView::ExecuteWindowsCommand(int command_id) {}

std::string BrowserView::GetWindowName() const {}

bool BrowserView::ShouldSaveWindowPlacement() const {}

void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds,
                                      ui::WindowShowState show_state) {}

bool BrowserView::GetSavedWindowPlacement(
    const views::Widget* widget,
    gfx::Rect* bounds,
    ui::WindowShowState* show_state) const {}

views::View* BrowserView::GetContentsView() {}

views::ClientView* BrowserView::CreateClientView(views::Widget* widget) {}

views::View* BrowserView::CreateOverlayView() {}

#if BUILDFLAG(IS_MAC)
views::View* BrowserView::CreateMacOverlayView() {
  DCHECK(UsesImmersiveFullscreenMode());

  auto create_overlay_widget = [this](views::Widget* parent) -> views::Widget* {
    views::Widget::InitParams params(
        views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET,
        views::Widget::InitParams::TYPE_POPUP);
    params.child = true;
    params.parent = parent->GetNativeView();
    params.shadow_type = views::Widget::InitParams::ShadowType::kNone;
    params.activatable = views::Widget::InitParams::Activatable::kNo;
    params.is_overlay = true;
    OverlayWidget* overlay_widget = new OverlayWidget(GetWidget());

    // When the overlay is used some Views are moved to the overlay_widget. When
    // this happens we want the fullscreen state of the overlay_widget to match
    // that of BrowserView's Widget. Without this, some views would not think
    // they are in a fullscreen Widget, when we want them to behave as though
    // they are in a fullscreen Widget.
    overlay_widget->SetCheckParentForFullscreen();

    overlay_widget->Init(std::move(params));
    overlay_widget->SetNativeWindowProperty(kBrowserViewKey, this);

    // Disable sublevel widget layering because in fullscreen the NSWindow of
    // `overlay_widget_` is reparented to a AppKit-owned NSWindow that does not
    // have an associated Widget. This will cause issues in sublevel manager
    // which operates at the Widget level.
    if (overlay_widget->GetSublevelManager()) {
      overlay_widget->parent()->GetSublevelManager()->UntrackChildWidget(
          overlay_widget);
    }

    return overlay_widget;
  };

  // Create the toolbar overlay widget.
  overlay_widget_ = create_overlay_widget(GetWidget());

  // Create a new TopContainerOverlayView. The tab strip, omnibox, bookmarks
  // etc. will be contained within this view. Right clicking on the blank space
  // that is not taken up by the child views should show the context menu. Set
  // the BrowserFrame as the context menu controller to handle displaying the
  // top container context menu.
  std::unique_ptr<TopContainerOverlayView> overlay_view =
      std::make_unique<TopContainerOverlayView>(weak_ptr_factory_.GetWeakPtr());
  overlay_view->set_context_menu_controller(frame());

  overlay_view->SetEventTargeter(std::make_unique<views::ViewTargeter>(
      std::make_unique<OverlayViewTargeterDelegate>()));
  overlay_view_ = overlay_view.get();
  overlay_widget_->GetRootView()->AddChildView(std::move(overlay_view));

  if (UsesImmersiveFullscreenTabbedMode()) {
    // Create the tab overlay widget as a child of overlay_widget_.
    tab_overlay_widget_ = create_overlay_widget(overlay_widget_);
    std::unique_ptr<TabContainerOverlayView> tab_overlay_view =
        std::make_unique<TabContainerOverlayView>(
            weak_ptr_factory_.GetWeakPtr());
    tab_overlay_view->set_context_menu_controller(frame());
    tab_overlay_view->SetEventTargeter(std::make_unique<views::ViewTargeter>(
        std::make_unique<OverlayViewTargeterDelegate>()));
    tab_overlay_view_ = tab_overlay_view.get();
    tab_overlay_widget_->GetRootView()->AddChildView(
        std::move(tab_overlay_view));
  }

  return overlay_view_;
}
#endif  // IS_MAC

void BrowserView::OnWidgetDestroying(views::Widget* widget) {}

void BrowserView::OnWidgetActivationChanged(views::Widget* widget,
                                            bool active) {}

void BrowserView::OnWidgetBoundsChanged(views::Widget* widget,
                                        const gfx::Rect& new_bounds) {}

void BrowserView::OnWindowBeginUserBoundsChange() {}

void BrowserView::OnWindowEndUserBoundsChange() {}

void BrowserView::OnWidgetMove() {}

views::Widget* BrowserView::GetWidget() {}

const views::Widget* BrowserView::GetWidget() const {}

void BrowserView::CreateTabSearchBubble(const int tab_index) {}

void BrowserView::CloseTabSearchBubble() {}

void BrowserView::RevealTabStripIfNeeded() {}

void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {}

bool BrowserView::ShouldDescendIntoChildForEventHandling(
    gfx::NativeView child,
    const gfx::Point& location) {}

bool BrowserView::RotatePaneFocusFromView(views::View* focused_view,
                                          bool forward,
                                          bool enable_wrapping) {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, views::ClientView overrides:

views::CloseRequestResult BrowserView::OnWindowCloseRequested() {}

int BrowserView::NonClientHitTest(const gfx::Point& point) {}

gfx::Size BrowserView::GetMinimumSize() const {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, views::View overrides:

void BrowserView::Layout(PassKey) {}

void BrowserView::OnGestureEvent(ui::GestureEvent* event) {}

void BrowserView::ViewHierarchyChanged(
    const views::ViewHierarchyChangedDetails& details) {}

void BrowserView::AddedToWidget() {}

void BrowserView::PaintChildren(const views::PaintInfo& paint_info) {}

void BrowserView::OnThemeChanged() {}

bool BrowserView::GetDropFormats(
    int* formats,
    std::set<ui::ClipboardFormatType>* format_types) {}

bool BrowserView::AreDropTypesRequired() {}

bool BrowserView::CanDrop(const ui::OSExchangeData& data) {}

void BrowserView::OnDragEntered(const ui::DropTargetEvent& event) {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, ui::AcceleratorTarget overrides:

bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, infobars::InfoBarContainer::Delegate overrides:

void BrowserView::InfoBarContainerStateChanged(bool is_animating) {}

void BrowserView::MaybeInitializeWebUITabStrip() {}

void BrowserView::LoadingAnimationCallback() {}

#if BUILDFLAG(IS_WIN)
void BrowserView::CreateJumpList() {
  // Ensure that this browser's Profile has a JumpList so that the JumpList is
  // kept up to date.
  JumpListFactory::GetForProfile(browser_->profile());
}
#endif

BrowserViewLayout* BrowserView::GetBrowserViewLayout() const {}

ContentsLayoutManager* BrowserView::GetContentsLayoutManager() const {}

bool BrowserView::MaybeShowBookmarkBar(WebContents* contents) {}

bool BrowserView::MaybeShowInfoBar(WebContents* contents) {}

void BrowserView::UpdateDevToolsForContents(WebContents* web_contents,
                                            bool update_devtools_web_contents) {}

void BrowserView::UpdateUIForContents(WebContents* contents) {}

void BrowserView::PrepareFullscreen(bool fullscreen) {}

void BrowserView::ProcessFullscreen(bool fullscreen, const int64_t display_id) {}

void BrowserView::RequestFullscreen(bool fullscreen, int64_t display_id) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
namespace {
bool ShouldBeHandledByLacrosInstead(int command) {
  switch (command) {
    case IDC_NEW_INCOGNITO_WINDOW:
    case IDC_NEW_TAB:
    case IDC_NEW_WINDOW:
    case IDC_RESTORE_TAB:
      // TODO(neis): Add more here, perhaps anything tab-related.
      return true;
    default:
      return false;
  }
}
}  // namespace
#endif

void BrowserView::LoadAccelerators() {}

int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const {}

void BrowserView::UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
                                           int command_id) {}

void BrowserView::ShowAvatarBubbleFromAvatarButton(bool is_source_accelerator) {}

void BrowserView::ShowBubbleFromManagementToolbarButton() {}

void BrowserView::MaybeShowProfileSwitchIPH() {}

void BrowserView::ShowHatsDialog(
    const std::string& site_id,
    const std::optional<std::string>& histogram_name,
    base::OnceClosure success_callback,
    base::OnceClosure failure_callback,
    const SurveyBitsData& product_specific_bits_data,
    const SurveyStringData& product_specific_string_data) {}

void BrowserView::ShowIncognitoClearBrowsingDataDialog() {}

void BrowserView::ShowIncognitoHistoryDisclaimerDialog() {}

void BrowserView::UpdateWebAppStatusIconsVisiblity() {}

ExclusiveAccessContext* BrowserView::GetExclusiveAccessContext() {}

std::string BrowserView::GetWorkspace() const {}

bool BrowserView::IsVisibleOnAllWorkspaces() const {}

void BrowserView::ShowEmojiPanel() {}

void BrowserView::ShowCaretBrowsingDialog() {}

std::unique_ptr<content::EyeDropper> BrowserView::OpenEyeDropper(
    content::RenderFrameHost* frame,
    content::EyeDropperListener* listener) {}

BrowserFeaturePromoController* BrowserView::GetFeaturePromoController() {}

bool BrowserView::IsFeaturePromoActive(const base::Feature& iph_feature) const {}

user_education::FeaturePromoResult BrowserView::CanShowFeaturePromo(
    const base::Feature& iph_feature) const {}

user_education::FeaturePromoResult BrowserView::MaybeShowFeaturePromo(
    user_education::FeaturePromoParams params) {}

bool BrowserView::MaybeShowStartupFeaturePromo(
    user_education::FeaturePromoParams params) {}

bool BrowserView::CloseFeaturePromo(
    const base::Feature& iph_feature,
    user_education::EndFeaturePromoReason end_promo_reason) {}

user_education::FeaturePromoHandle BrowserView::CloseFeaturePromoAndContinue(
    const base::Feature& iph_feature) {}

void BrowserView::NotifyFeatureEngagementEvent(const char* event_name) {}

void BrowserView::NotifyPromoFeatureUsed(const base::Feature& feature) {}

user_education::DisplayNewBadge BrowserView::MaybeShowNewBadgeFor(
    const base::Feature& feature) {}

void BrowserView::ActivateAppModalDialog() const {}

bool BrowserView::FindCommandIdForAccelerator(
    const ui::Accelerator& accelerator,
    int* command_id) const {}

void BrowserView::ObserveAppBannerManager(
    webapps::AppBannerManager* new_manager) {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, ExclusiveAccessContext implementation:
Profile* BrowserView::GetProfile() {}

void BrowserView::UpdateUIForTabFullscreen() {}

WebContents* BrowserView::GetWebContentsForExclusiveAccess() {}

void BrowserView::UnhideDownloadShelf() {}

void BrowserView::HideDownloadShelf() {}

bool BrowserView::CanUserExitFullscreen() const {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, ExclusiveAccessBubbleViewsContext implementation:
ExclusiveAccessManager* BrowserView::GetExclusiveAccessManager() {}

ui::AcceleratorProvider* BrowserView::GetAcceleratorProvider() {}

gfx::NativeView BrowserView::GetBubbleParentView() const {}

gfx::Rect BrowserView::GetClientAreaBoundsInScreen() const {}

bool BrowserView::IsImmersiveModeEnabled() const {}

gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {}

void BrowserView::DestroyAnyExclusiveAccessBubble() {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, extension::ExtensionKeybindingRegistry::Delegate implementation:
content::WebContents* BrowserView::GetWebContentsForExtension() {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, ImmersiveModeController::Observer implementation:
void BrowserView::OnImmersiveRevealStarted() {}

void BrowserView::OnImmersiveRevealEnded() {}

void BrowserView::OnImmersiveFullscreenExited() {}

void BrowserView::OnImmersiveModeControllerDestroyed() {}

///////////////////////////////////////////////////////////////////////////////
// BrowserView, webapps::AppBannerManager::Observer implementation:
void BrowserView::OnInstallableWebAppStatusUpdated(
    webapps::InstallableWebAppCheckResult result,
    const std::optional<webapps::WebAppBannerData>& data) {}

WebAppFrameToolbarView* BrowserView::web_app_frame_toolbar() {}

const WebAppFrameToolbarView* BrowserView::web_app_frame_toolbar() const {}

void BrowserView::PaintAsActiveChanged() {}

void BrowserView::FrameColorsChanged() {}

void BrowserView::UpdateFullscreenAllowedFromPolicy(
    bool allowed_without_policy) {}

void BrowserView::ApplyWatermarkSettings(const std::string& watermark_text) {}

#if BUILDFLAG(ENTERPRISE_SCREENSHOT_PROTECTION)
void BrowserView::ApplyScreenshotSettings(bool allow) {
#if BUILDFLAG(IS_WIN)
  DCHECK_NE(GetWidget()->GetNativeWindow()->GetHost()->GetAcceleratedWidget(),
            gfx::kNullAcceleratedWidget);
#endif  // BUILDFLAG(IS_WIN)
  GetWidget()->SetAllowScreenshots(allow);
}
#endif  // BUILDFLAG(ENTERPRISE_SCREENSHOT_PROTECTION)

BEGIN_METADATA()