OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DESKTOP_HOST_WIN_H_ | 5 #ifndef UI_AURA_DESKTOP_HOST_WIN_H_ |
6 #define UI_AURA_DESKTOP_HOST_WIN_H_ | 6 #define UI_AURA_DESKTOP_HOST_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/aura/desktop_host.h" | 10 #include "ui/aura/desktop_host.h" |
| 11 #include "ui/base/ime/input_method_delegate.h" |
| 12 #include "ui/base/ime/mock_input_method.h" |
11 #include "ui/base/win/window_impl.h" | 13 #include "ui/base/win/window_impl.h" |
12 | 14 |
13 namespace aura { | 15 namespace aura { |
14 | 16 |
15 class DesktopHostWin : public DesktopHost, public ui::WindowImpl { | 17 class DesktopHostWin : public DesktopHost, |
| 18 public ui::internal::InputMethodDelegate, |
| 19 public ui::WindowImpl { |
16 public: | 20 public: |
17 explicit DesktopHostWin(const gfx::Rect& bounds); | 21 explicit DesktopHostWin(const gfx::Rect& bounds); |
18 virtual ~DesktopHostWin(); | 22 virtual ~DesktopHostWin(); |
19 | 23 |
20 // MessageLoop::Dispatcher: | 24 // MessageLoop::Dispatcher: |
21 virtual bool Dispatch(const MSG& msg); | 25 virtual bool Dispatch(const MSG& msg); |
22 | 26 |
23 // DesktopHost: | 27 // DesktopHost: |
24 virtual void SetDesktop(Desktop* desktop) OVERRIDE; | 28 virtual void SetDesktop(Desktop* desktop) OVERRIDE; |
25 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 29 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
26 virtual void Show() OVERRIDE; | 30 virtual void Show() OVERRIDE; |
27 virtual void ToggleFullScreen() OVERRIDE; | 31 virtual void ToggleFullScreen() OVERRIDE; |
28 virtual gfx::Size GetSize() const OVERRIDE; | 32 virtual gfx::Size GetSize() const OVERRIDE; |
29 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 33 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
30 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; | 34 virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; |
31 virtual gfx::Point QueryMouseLocation() OVERRIDE; | 35 virtual gfx::Point QueryMouseLocation() OVERRIDE; |
| 36 virtual ui::InputMethod* GetInputMethod() OVERRIDE; |
| 37 |
| 38 // ui::internal::InputMethodDelegate Override. |
| 39 virtual void DispatchKeyEventPostIME(Event* event) OVERRIDE; |
32 | 40 |
33 private: | 41 private: |
34 BEGIN_MSG_MAP_EX(DesktopHostWin) | 42 BEGIN_MSG_MAP_EX(DesktopHostWin) |
35 // Range handlers must go first! | 43 // Range handlers must go first! |
36 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) | 44 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) |
37 MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange) | 45 MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange) |
38 | 46 |
39 // Key events. | 47 // Key events. |
40 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent) | 48 MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent) |
41 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent) | 49 MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent) |
42 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent) | 50 MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent) |
43 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent) | 51 MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent) |
44 MESSAGE_HANDLER_EX(WM_CHAR, OnKeyEvent) | 52 MESSAGE_HANDLER_EX(WM_CHAR, OnKeyEvent) |
45 MESSAGE_HANDLER_EX(WM_SYSCHAR, OnKeyEvent) | 53 MESSAGE_HANDLER_EX(WM_SYSCHAR, OnKeyEvent) |
46 MESSAGE_HANDLER_EX(WM_IME_CHAR, OnKeyEvent) | 54 MESSAGE_HANDLER_EX(WM_IME_CHAR, OnKeyEvent) |
47 | 55 |
48 MSG_WM_CLOSE(OnClose) | 56 MSG_WM_CLOSE(OnClose) |
49 MSG_WM_PAINT(OnPaint) | 57 MSG_WM_PAINT(OnPaint) |
50 MSG_WM_SIZE(OnSize) | 58 MSG_WM_SIZE(OnSize) |
51 END_MSG_MAP() | 59 END_MSG_MAP() |
52 | 60 |
53 void OnClose(); | 61 void OnClose(); |
54 LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param); | 62 LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param); |
55 LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param); | 63 LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param); |
56 void OnPaint(HDC dc); | 64 void OnPaint(HDC dc); |
57 void OnSize(UINT param, const CSize& size); | 65 void OnSize(UINT param, const CSize& size); |
58 | 66 |
59 Desktop* desktop_; | 67 Desktop* desktop_; |
60 | 68 |
| 69 // TODO(yusukes): implement ui::InputMethodWin. |
| 70 ui::MockInputMethod input_method_; |
| 71 |
61 bool fullscreen_; | 72 bool fullscreen_; |
62 RECT saved_window_rect_; | 73 RECT saved_window_rect_; |
63 DWORD saved_window_style_; | 74 DWORD saved_window_style_; |
64 DWORD saved_window_ex_style_; | 75 DWORD saved_window_ex_style_; |
65 | 76 |
66 DISALLOW_COPY_AND_ASSIGN(DesktopHostWin); | 77 DISALLOW_COPY_AND_ASSIGN(DesktopHostWin); |
67 }; | 78 }; |
68 | 79 |
69 } // namespace aura | 80 } // namespace aura |
70 | 81 |
71 #endif // UI_AURA_DESKTOP_HOST_WIN_H_ | 82 #endif // UI_AURA_DESKTOP_HOST_WIN_H_ |
OLD | NEW |