chromium/chrome/browser/ui/views/media_router/presentation_receiver_window_view.cc

// Copyright 2017 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/media_router/presentation_receiver_window_view.h"

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/mixed_content_settings_tab_helper.h"
#include "chrome/browser/content_settings/page_specific_content_settings_delegate.h"
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/chrome_password_reuse_detection_manager_client.h"
#include "chrome/browser/ssl/chrome_security_state_tab_helper.h"
#include "chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_helper_factory.h"
#include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/ui/autofill/chrome_autofill_client.h"
#include "chrome/browser/ui/blocked_content/framebust_block_tab_helper.h"
#include "chrome/browser/ui/media_router/presentation_receiver_window_delegate.h"
#include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/tab_dialogs.h"
#include "chrome/browser/ui/views/accelerator_table.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/media_router/presentation_receiver_window_frame.h"
#include "components/autofill/content/browser/content_autofill_client.h"
#include "components/autofill/content/browser/content_autofill_driver_factory.h"
#include "components/autofill/core/browser/browser_autofill_manager.h"
#include "components/blocked_content/popup_blocker_tab_helper.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "components/omnibox/browser/location_bar_model_impl.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_constants.h"
#include "ui/base/accelerators/accelerator_manager.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/focus/focus_manager.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/widget/widget.h"

#if BUILDFLAG(IS_MAC)
#include "chrome/browser/global_keyboard_shortcuts_mac.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/window_properties.h"
#include "base/functional/callback.h"
#include "base/scoped_observation.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/gfx/native_widget_types.h"
#endif

WebContents;

#if BUILDFLAG(IS_CHROMEOS_ASH)
// Observes the NativeWindow hosting the receiver view to look for fullscreen
// state changes.  This helps monitor fullscreen changes that don't go through
// the normal key accelerator to display and hide the location bar.
class FullscreenWindowObserver : public aura::WindowObserver {
 public:
  FullscreenWindowObserver(aura::Window* observed_window,
                           base::RepeatingClosure on_fullscreen_change)
      : on_fullscreen_change_(on_fullscreen_change) {
    window_observation_.Observe(observed_window);
  }

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

  ~FullscreenWindowObserver() override = default;

 private:
  // aura::WindowObserver overrides.
  void OnWindowPropertyChanged(aura::Window* window,
                               const void* key,
                               intptr_t old) override {
    if (key == aura::client::kShowStateKey) {
      ui::WindowShowState new_state =
          window->GetProperty(aura::client::kShowStateKey);
      ui::WindowShowState old_state = static_cast<ui::WindowShowState>(old);
      if (old_state == ui::SHOW_STATE_FULLSCREEN ||
          new_state == ui::SHOW_STATE_FULLSCREEN) {
        on_fullscreen_change_.Run();
      }
    }
  }

  void OnWindowDestroying(aura::Window* window) override {
    DCHECK(window_observation_.IsObserving());
    window_observation_.Reset();
  }

  base::RepeatingClosure on_fullscreen_change_;

  base::ScopedObservation<aura::Window, aura::WindowObserver>
      window_observation_{this};
};

#endif

PresentationReceiverWindowView::PresentationReceiverWindowView(
    PresentationReceiverWindowFrame* frame,
    PresentationReceiverWindowDelegate* delegate)
    :{}

PresentationReceiverWindowView::~PresentationReceiverWindowView() = default;

void PresentationReceiverWindowView::Init() {}

void PresentationReceiverWindowView::Close() {}

bool PresentationReceiverWindowView::IsWindowActive() const {}

bool PresentationReceiverWindowView::IsWindowFullscreen() const {}

gfx::Rect PresentationReceiverWindowView::GetWindowBounds() const {}

void PresentationReceiverWindowView::ShowInactiveFullscreen() {}

void PresentationReceiverWindowView::UpdateWindowTitle() {}

void PresentationReceiverWindowView::UpdateLocationBar() {}

WebContents* PresentationReceiverWindowView::GetWebContents() {}

LocationBarModel* PresentationReceiverWindowView::GetLocationBarModel() {}

const LocationBarModel* PresentationReceiverWindowView::GetLocationBarModel()
    const {}

ContentSettingBubbleModelDelegate*
PresentationReceiverWindowView::GetContentSettingBubbleModelDelegate() {}

void PresentationReceiverWindowView::ExecuteCommandWithDisposition(
    int id,
    WindowOpenDisposition disposition) {}

WebContents* PresentationReceiverWindowView::GetActiveWebContents() const {}

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

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

Profile* PresentationReceiverWindowView::GetProfile() {}

bool PresentationReceiverWindowView::IsFullscreen() const {}

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

void PresentationReceiverWindowView::ExitFullscreen() {}

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

bool PresentationReceiverWindowView::IsExclusiveAccessBubbleDisplayed() const {}

void PresentationReceiverWindowView::OnExclusiveAccessUserInput() {}

content::WebContents*
PresentationReceiverWindowView::GetWebContentsForExclusiveAccess() {}

bool PresentationReceiverWindowView::CanUserExitFullscreen() const {}

ExclusiveAccessManager*
PresentationReceiverWindowView::GetExclusiveAccessManager() {}

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

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

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

bool PresentationReceiverWindowView::IsImmersiveModeEnabled() const {}

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

void PresentationReceiverWindowView::DestroyAnyExclusiveAccessBubble() {}

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

void PresentationReceiverWindowView::OnFullscreenChanged() {}

BEGIN_METADATA()