From 1b4ef1a69b08dd2d779521118ddb1f3a285d4c83 Mon Sep 17 00:00:00 2001 From: sievers Date: Fri, 16 Oct 2015 13:44:36 -0700 Subject: aura: Unify Ozone+Windows+Android WindowTreeHost This effectively adds an Android WindowTreeHost. For these three most platform-specific stuff happens in PlatformWindow* and the WTH is mostly a shim. BUG=507792 Review URL: https://codereview.chromium.org/1390883003 Cr-Commit-Position: refs/heads/master@{#354585} --- ash/host/ash_window_tree_host_ozone.cc | 8 +++---- ash/host/ash_window_tree_host_win.cc | 43 +++++++++++++++------------------- ash/test/ash_test_base.cc | 1 - 3 files changed, 23 insertions(+), 29 deletions(-) (limited to 'ash') diff --git a/ash/host/ash_window_tree_host_ozone.cc b/ash/host/ash_window_tree_host_ozone.cc index 85b3fae..d4b679c 100644 --- a/ash/host/ash_window_tree_host_ozone.cc +++ b/ash/host/ash_window_tree_host_ozone.cc @@ -12,7 +12,7 @@ #include "base/command_line.h" #include "base/trace_event/trace_event.h" #include "ui/aura/window.h" -#include "ui/aura/window_tree_host_ozone.h" +#include "ui/aura/window_tree_host_platform.h" #include "ui/events/event_processor.h" #include "ui/events/null_event_targeter.h" #include "ui/gfx/geometry/insets.h" @@ -25,7 +25,7 @@ namespace ash { namespace { class AshWindowTreeHostOzone : public AshWindowTreeHost, - public aura::WindowTreeHostOzone { + public aura::WindowTreeHostPlatform { public: explicit AshWindowTreeHostOzone(const gfx::Rect& initial_bounds); ~AshWindowTreeHostOzone() override; @@ -61,7 +61,7 @@ class AshWindowTreeHostOzone : public AshWindowTreeHost, }; AshWindowTreeHostOzone::AshWindowTreeHostOzone(const gfx::Rect& initial_bounds) - : aura::WindowTreeHostOzone(initial_bounds), transformer_helper_(this) { + : aura::WindowTreeHostPlatform(initial_bounds), transformer_helper_(this) { transformer_helper_.Init(); } @@ -127,7 +127,7 @@ void AshWindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) { } void AshWindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) { - WindowTreeHostOzone::SetBounds(bounds); + WindowTreeHostPlatform::SetBounds(bounds); ConfineCursorToRootWindow(); } diff --git a/ash/host/ash_window_tree_host_win.cc b/ash/host/ash_window_tree_host_win.cc index e69769c..287fc56 100644 --- a/ash/host/ash_window_tree_host_win.cc +++ b/ash/host/ash_window_tree_host_win.cc @@ -13,7 +13,7 @@ #include "ash/ime/input_method_event_handler.h" #include "base/command_line.h" #include "base/win/windows_version.h" -#include "ui/aura/window_tree_host_win.h" +#include "ui/aura/window_tree_host_platform.h" #include "ui/events/event_processor.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/transform.h" @@ -22,10 +22,10 @@ namespace ash { namespace { class AshWindowTreeHostWin : public AshWindowTreeHost, - public aura::WindowTreeHostWin { + public aura::WindowTreeHostPlatform { public: explicit AshWindowTreeHostWin(const gfx::Rect& initial_bounds) - : aura::WindowTreeHostWin(initial_bounds), + : aura::WindowTreeHostPlatform(initial_bounds), fullscreen_(false), saved_window_style_(0), saved_window_ex_style_(0), @@ -38,36 +38,31 @@ class AshWindowTreeHostWin : public AshWindowTreeHost, // AshWindowTreeHost: void ToggleFullScreen() override { gfx::Rect target_rect; + gfx::AcceleratedWidget hwnd = GetAcceleratedWidget(); if (!fullscreen_) { fullscreen_ = true; - saved_window_style_ = GetWindowLong(hwnd(), GWL_STYLE); - saved_window_ex_style_ = GetWindowLong(hwnd(), GWL_EXSTYLE); - GetWindowRect(hwnd(), &saved_window_rect_); - SetWindowLong(hwnd(), - GWL_STYLE, + saved_window_style_ = GetWindowLong(hwnd, GWL_STYLE); + saved_window_ex_style_ = GetWindowLong(hwnd, GWL_EXSTYLE); + GetWindowRect(hwnd, &saved_window_rect_); + SetWindowLong(hwnd, GWL_STYLE, saved_window_style_ & ~(WS_CAPTION | WS_THICKFRAME)); - SetWindowLong( - hwnd(), - GWL_EXSTYLE, - saved_window_ex_style_ & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | - WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); + SetWindowLong(hwnd, GWL_EXSTYLE, + saved_window_ex_style_ & + ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | + WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); MONITORINFO mi; mi.cbSize = sizeof(mi); - GetMonitorInfo(MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST), &mi); + GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST), &mi); target_rect = gfx::Rect(mi.rcMonitor); } else { fullscreen_ = false; - SetWindowLong(hwnd(), GWL_STYLE, saved_window_style_); - SetWindowLong(hwnd(), GWL_EXSTYLE, saved_window_ex_style_); + SetWindowLong(hwnd, GWL_STYLE, saved_window_style_); + SetWindowLong(hwnd, GWL_EXSTYLE, saved_window_ex_style_); target_rect = gfx::Rect(saved_window_rect_); } - SetWindowPos(hwnd(), - NULL, - target_rect.x(), - target_rect.y(), - target_rect.width(), - target_rect.height(), + SetWindowPos(hwnd, NULL, target_rect.x(), target_rect.y(), + target_rect.width(), target_rect.height(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); } bool ConfineCursorToRootWindow() override { return false; } @@ -81,14 +76,14 @@ class AshWindowTreeHostWin : public AshWindowTreeHost, } aura::WindowTreeHost* AsWindowTreeHost() override { return this; } - // WindowTreeHostWin: + // WindowTreeHost: void SetBounds(const gfx::Rect& bounds) override { if (fullscreen_) { saved_window_rect_.right = saved_window_rect_.left + bounds.width(); saved_window_rect_.bottom = saved_window_rect_.top + bounds.height(); return; } - WindowTreeHostWin::SetBounds(bounds); + aura::WindowTreeHostPlatform::SetBounds(bounds); } void SetRootTransform(const gfx::Transform& transform) override { transformer_helper_.SetTransform(transform); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 3a799fe..7b0d5a0 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -41,7 +41,6 @@ #if defined(OS_WIN) #include "base/win/windows_version.h" #include "ui/aura/remote_window_tree_host_win.h" -#include "ui/aura/window_tree_host_win.h" #include "ui/platform_window/win/win_window.h" #include "win8/test/test_registrar_constants.h" #endif -- cgit v1.1