1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_AURA_ROOT_WINDOW_HOST_WIN_H_
6 #define UI_AURA_ROOT_WINDOW_HOST_WIN_H_
8 #include "base/compiler_specific.h"
9 #include "ui/aura/aura_export.h"
10 #include "ui/aura/window_tree_host.h"
11 #include "ui/gfx/win/window_impl.h"
15 class WindowTreeHostWin
: public WindowTreeHost
, public gfx::WindowImpl
{
17 WindowTreeHostWin(const gfx::Rect
& bounds
);
18 virtual ~WindowTreeHostWin();
20 virtual RootWindow
* GetRootWindow() OVERRIDE
;
21 virtual gfx::AcceleratedWidget
GetAcceleratedWidget() OVERRIDE
;
22 virtual void Show() OVERRIDE
;
23 virtual void Hide() OVERRIDE
;
24 virtual void ToggleFullScreen() OVERRIDE
;
25 virtual gfx::Rect
GetBounds() const OVERRIDE
;
26 virtual void SetBounds(const gfx::Rect
& bounds
) OVERRIDE
;
27 virtual gfx::Insets
GetInsets() const OVERRIDE
;
28 virtual void SetInsets(const gfx::Insets
& insets
) OVERRIDE
;
29 virtual gfx::Point
GetLocationOnNativeScreen() const OVERRIDE
;
30 virtual void SetCapture() OVERRIDE
;
31 virtual void ReleaseCapture() OVERRIDE
;
32 virtual void SetCursor(gfx::NativeCursor cursor
) OVERRIDE
;
33 virtual bool QueryMouseLocation(gfx::Point
* location_return
) OVERRIDE
;
34 virtual bool ConfineCursorToRootWindow() OVERRIDE
;
35 virtual void UnConfineCursor() OVERRIDE
;
36 virtual void OnCursorVisibilityChanged(bool show
) OVERRIDE
;
37 virtual void MoveCursorTo(const gfx::Point
& location
) OVERRIDE
;
38 virtual void PostNativeEvent(const base::NativeEvent
& native_event
) OVERRIDE
;
39 virtual void OnDeviceScaleFactorChanged(float device_scale_factor
) OVERRIDE
;
40 virtual void PrepareForShutdown() OVERRIDE
;
43 BEGIN_MSG_MAP_EX(WindowTreeHostWin
)
44 // Range handlers must go first!
45 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST
, WM_MOUSELAST
, OnMouseRange
)
46 MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE
, WM_NCXBUTTONDBLCLK
, OnMouseRange
)
48 // Mouse capture events.
49 MESSAGE_HANDLER_EX(WM_CAPTURECHANGED
, OnCaptureChanged
)
52 MESSAGE_HANDLER_EX(WM_KEYDOWN
, OnKeyEvent
)
53 MESSAGE_HANDLER_EX(WM_KEYUP
, OnKeyEvent
)
54 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN
, OnKeyEvent
)
55 MESSAGE_HANDLER_EX(WM_SYSKEYUP
, OnKeyEvent
)
56 MESSAGE_HANDLER_EX(WM_CHAR
, OnKeyEvent
)
57 MESSAGE_HANDLER_EX(WM_SYSCHAR
, OnKeyEvent
)
58 MESSAGE_HANDLER_EX(WM_IME_CHAR
, OnKeyEvent
)
59 MESSAGE_HANDLER_EX(WM_NCACTIVATE
, OnNCActivate
)
68 LRESULT
OnKeyEvent(UINT message
, WPARAM w_param
, LPARAM l_param
);
69 LRESULT
OnMouseRange(UINT message
, WPARAM w_param
, LPARAM l_param
);
70 LRESULT
OnCaptureChanged(UINT message
, WPARAM w_param
, LPARAM l_param
);
71 LRESULT
OnNCActivate(UINT message
, WPARAM w_param
, LPARAM l_param
);
72 void OnMove(const CPoint
& point
);
74 void OnSize(UINT param
, const CSize
& size
);
78 RECT saved_window_rect_
;
79 DWORD saved_window_style_
;
80 DWORD saved_window_ex_style_
;
82 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostWin
);
87 // Set true to let WindowTreeHostWin use a popup window
88 // with no frame/title so that the window size and test's
89 // expectations matches.
90 AURA_EXPORT
void SetUsePopupAsRootWindowForTest(bool use
);
96 #endif // UI_AURA_ROOT_WINDOW_HOST_WIN_H_