#include "ui/aura/window_tree_host_platform.h"
#include <memory>
#include <optional>
#include <utility>
#include "base/check_is_test.h"
#include "base/functional/bind.h"
#include "base/observer_list.h"
#include "base/run_loop.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/env.h"
#include "ui/aura/host_frame_rate_throttler.h"
#include "ui/aura/native_window_occlusion_tracker.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host_observer.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/base/layout.h"
#include "ui/base/view_prop.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/keyboard_hook.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_init_properties.h"
#if BUILDFLAG(IS_OZONE)
#include "ui/events/keycodes/dom/dom_keyboard_layout_map.h"
#include "ui/events/ozone/events_ozone.h"
#include "ui/ozone/public/ozone_platform.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "ui/platform_window/win/win_window.h"
#endif
namespace aura {
namespace {
WindowTreeHostPlatform::PlatformWindowFactoryDelegateForTesting*
g_platform_window_factory_delegate_for_testing = …;
const char kWindowTreeHostPlatformForAcceleratedWidget[] = …;
}
std::unique_ptr<WindowTreeHost> WindowTreeHost::Create(
ui::PlatformWindowInitProperties properties) { … }
WindowTreeHostPlatform::WindowTreeHostPlatform(
ui::PlatformWindowInitProperties properties,
std::unique_ptr<Window> window)
: … { … }
WindowTreeHostPlatform::WindowTreeHostPlatform(std::unique_ptr<Window> window)
: … { … }
WindowTreeHostPlatform* WindowTreeHostPlatform::GetHostForWindow(
aura::Window* window) { … }
void WindowTreeHostPlatform::CreateAndSetPlatformWindow(
ui::PlatformWindowInitProperties properties) { … }
void WindowTreeHostPlatform::SetPlatformWindow(
std::unique_ptr<ui::PlatformWindow> window) { … }
WindowTreeHostPlatform::~WindowTreeHostPlatform() { … }
ui::EventSource* WindowTreeHostPlatform::GetEventSource() { … }
gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() { … }
void WindowTreeHostPlatform::ShowImpl() { … }
void WindowTreeHostPlatform::HideImpl() { … }
gfx::Rect WindowTreeHostPlatform::GetBoundsInPixels() const { … }
void WindowTreeHostPlatform::SetBoundsInPixels(const gfx::Rect& bounds) { … }
void WindowTreeHostPlatform::SetCapture() { … }
void WindowTreeHostPlatform::ReleaseCapture() { … }
gfx::Point WindowTreeHostPlatform::GetLocationOnScreenInPixels() const { … }
bool WindowTreeHostPlatform::CaptureSystemKeyEventsImpl(
std::optional<base::flat_set<ui::DomCode>> dom_codes) { … }
void WindowTreeHostPlatform::ReleaseSystemKeyEventCapture() { … }
bool WindowTreeHostPlatform::IsKeyLocked(ui::DomCode dom_code) { … }
base::flat_map<std::string, std::string>
WindowTreeHostPlatform::GetKeyboardLayoutMap() { … }
void WindowTreeHostPlatform::SetCursorNative(gfx::NativeCursor cursor) { … }
void WindowTreeHostPlatform::MoveCursorToScreenLocationInPixels(
const gfx::Point& location_in_pixels) { … }
void WindowTreeHostPlatform::OnCursorVisibilityChangedNative(bool show) { … }
void WindowTreeHostPlatform::LockMouse(Window* window) { … }
std::unique_ptr<ui::PlatformWindow>
WindowTreeHostPlatform::CreatePlatformWindow(
ui::PlatformWindowInitProperties properties) { … }
void WindowTreeHostPlatform::SetPlatformWindowFactoryDelegateForTesting(
PlatformWindowFactoryDelegateForTesting* delegate) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
std::string WindowTreeHostPlatform::GetUniqueId() const {
return platform_window()->GetWindowUniqueId();
}
#endif
void WindowTreeHostPlatform::OnBoundsChanged(const BoundsChange& change) { … }
void WindowTreeHostPlatform::OnDamageRect(const gfx::Rect& damage_rect) { … }
void WindowTreeHostPlatform::DispatchEvent(ui::Event* event) { … }
void WindowTreeHostPlatform::OnCloseRequest() { … }
void WindowTreeHostPlatform::OnClosed() { … }
void WindowTreeHostPlatform::OnWindowStateChanged(
ui::PlatformWindowState old_state,
ui::PlatformWindowState new_state) { … }
void WindowTreeHostPlatform::OnLostCapture() { … }
void WindowTreeHostPlatform::OnAcceleratedWidgetAvailable(
gfx::AcceleratedWidget widget) { … }
void WindowTreeHostPlatform::OnWillDestroyAcceleratedWidget() { … }
void WindowTreeHostPlatform::OnAcceleratedWidgetDestroyed() { … }
void WindowTreeHostPlatform::OnActivationChanged(bool active) { … }
void WindowTreeHostPlatform::OnMouseEnter() { … }
void WindowTreeHostPlatform::OnOcclusionStateChanged(
ui::PlatformWindowOcclusionState occlusion_state) { … }
int64_t WindowTreeHostPlatform::OnStateUpdate(
const PlatformWindowDelegate::State& old,
const PlatformWindowDelegate::State& latest) { … }
void WindowTreeHostPlatform::SetFrameRateThrottleEnabled(bool enabled) { … }
void WindowTreeHostPlatform::DisableNativeWindowOcclusion() { … }
}