Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: trunk/src/ui/aura/window_tree_host_win.h

Issue 410873003: Revert 284850 "aura: Use PlatformWindow from WindowTreeHostWin." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/ui/aura/window_tree_host_ozone.cc ('k') | trunk/src/ui/aura/window_tree_host_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_AURA_WINDOW_TREE_HOST_WIN_H_ 5 #ifndef UI_AURA_WINDOW_TREE_HOST_WIN_H_
6 #define UI_AURA_WINDOW_TREE_HOST_WIN_H_ 6 #define UI_AURA_WINDOW_TREE_HOST_WIN_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/aura/aura_export.h" 9 #include "ui/aura/aura_export.h"
11 #include "ui/aura/window_tree_host.h" 10 #include "ui/aura/window_tree_host.h"
12 #include "ui/events/event_source.h" 11 #include "ui/events/event_source.h"
13 #include "ui/platform_window/platform_window.h" 12 #include "ui/gfx/win/window_impl.h"
14 #include "ui/platform_window/platform_window_delegate.h"
15 13
16 namespace aura { 14 namespace aura {
17 15
18 class AURA_EXPORT WindowTreeHostWin 16 class AURA_EXPORT WindowTreeHostWin : public WindowTreeHost,
19 : public WindowTreeHost, 17 public ui::EventSource,
20 public ui::EventSource, 18 public gfx::WindowImpl {
21 public NON_EXPORTED_BASE(ui::PlatformWindowDelegate) {
22 public: 19 public:
23 explicit WindowTreeHostWin(const gfx::Rect& bounds); 20 explicit WindowTreeHostWin(const gfx::Rect& bounds);
24 virtual ~WindowTreeHostWin(); 21 virtual ~WindowTreeHostWin();
25
26 // WindowTreeHost: 22 // WindowTreeHost:
27 virtual ui::EventSource* GetEventSource() OVERRIDE; 23 virtual ui::EventSource* GetEventSource() OVERRIDE;
28 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; 24 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
29 virtual void Show() OVERRIDE; 25 virtual void Show() OVERRIDE;
30 virtual void Hide() OVERRIDE; 26 virtual void Hide() OVERRIDE;
31 virtual gfx::Rect GetBounds() const OVERRIDE; 27 virtual gfx::Rect GetBounds() const OVERRIDE;
32 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 28 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
33 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE; 29 virtual gfx::Point GetLocationOnNativeScreen() const OVERRIDE;
34 virtual void SetCapture() OVERRIDE; 30 virtual void SetCapture() OVERRIDE;
35 virtual void ReleaseCapture() OVERRIDE; 31 virtual void ReleaseCapture() OVERRIDE;
36 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; 32 virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE;
37 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; 33 virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE;
38 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; 34 virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE;
39 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; 35 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
40 36
41 // ui::EventSource: 37 // ui::EventSource:
42 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; 38 virtual ui::EventProcessor* GetEventProcessor() OVERRIDE;
43 39
44 protected: 40 private:
45 gfx::AcceleratedWidget hwnd() const { return widget_; } 41 CR_BEGIN_MSG_MAP_EX(WindowTreeHostWin)
42 // Range handlers must go first!
43 CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
44 CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE,
45 WM_NCXBUTTONDBLCLK,
46 OnMouseRange)
46 47
47 private: 48 // Mouse capture events.
48 // ui::PlatformWindowDelegate: 49 CR_MESSAGE_HANDLER_EX(WM_CAPTURECHANGED, OnCaptureChanged)
49 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) OVERRIDE; 50
50 virtual void OnDamageRect(const gfx::Rect& damaged_region) OVERRIDE; 51 // Key events.
51 virtual void DispatchEvent(ui::Event* event) OVERRIDE; 52 CR_MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent)
52 virtual void OnCloseRequest() OVERRIDE; 53 CR_MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent)
53 virtual void OnClosed() OVERRIDE; 54 CR_MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent)
54 virtual void OnWindowStateChanged(ui::PlatformWindowState new_state) OVERRIDE; 55 CR_MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent)
55 virtual void OnLostCapture() OVERRIDE; 56 CR_MESSAGE_HANDLER_EX(WM_CHAR, OnKeyEvent)
56 virtual void OnAcceleratedWidgetAvailable( 57 CR_MESSAGE_HANDLER_EX(WM_SYSCHAR, OnKeyEvent)
57 gfx::AcceleratedWidget widget) OVERRIDE; 58 CR_MESSAGE_HANDLER_EX(WM_IME_CHAR, OnKeyEvent)
58 virtual void OnActivationChanged(bool active) OVERRIDE; 59 CR_MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate)
60
61 CR_MSG_WM_CLOSE(OnClose)
62 CR_MSG_WM_MOVE(OnMove)
63 CR_MSG_WM_PAINT(OnPaint)
64 CR_MSG_WM_SIZE(OnSize)
65 CR_END_MSG_MAP()
66
67 void OnClose();
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 gfx::Point& point);
73 void OnPaint(HDC dc);
74 void OnSize(UINT param, const gfx::Size& size);
59 75
60 bool has_capture_; 76 bool has_capture_;
61 gfx::Rect bounds_;
62 gfx::AcceleratedWidget widget_;
63 scoped_ptr<ui::PlatformWindow> window_;
64 77
65 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostWin); 78 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostWin);
66 }; 79 };
67 80
81 namespace test {
82
83 // Set true to let WindowTreeHostWin use a popup window
84 // with no frame/title so that the window size and test's
85 // expectations matches.
86 AURA_EXPORT void SetUsePopupAsRootWindowForTest(bool use);
87
88 } // namespace
89
68 } // namespace aura 90 } // namespace aura
69 91
70 #endif // UI_AURA_WINDOW_TREE_HOST_WIN_H_ 92 #endif // UI_AURA_WINDOW_TREE_HOST_WIN_H_
OLDNEW
« no previous file with comments | « trunk/src/ui/aura/window_tree_host_ozone.cc ('k') | trunk/src/ui/aura/window_tree_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698