OLD | NEW |
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_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
18 #include "base/win/scoped_gdi_object.h" | 18 #include "base/win/scoped_gdi_object.h" |
19 #include "base/win/win_util.h" | 19 #include "base/win/win_util.h" |
20 #include "ui/accessibility/ax_enums.h" | 20 #include "ui/accessibility/ax_enums.h" |
21 #include "ui/base/ui_base_types.h" | 21 #include "ui/base/ui_base_types.h" |
22 #include "ui/base/win/window_event_target.h" | 22 #include "ui/base/win/window_event_target.h" |
23 #include "ui/events/event.h" | 23 #include "ui/events/event.h" |
24 #include "ui/gfx/geometry/rect.h" | 24 #include "ui/gfx/geometry/rect.h" |
25 #include "ui/gfx/sequential_id_generator.h" | 25 #include "ui/gfx/sequential_id_generator.h" |
26 #include "ui/gfx/win/window_impl.h" | 26 #include "ui/gfx/win/window_impl.h" |
27 #include "ui/views/ime/input_method_delegate.h" | |
28 #include "ui/views/views_export.h" | 27 #include "ui/views/views_export.h" |
29 | 28 |
30 namespace gfx { | 29 namespace gfx { |
31 class Canvas; | 30 class Canvas; |
32 class ImageSkia; | 31 class ImageSkia; |
33 class Insets; | 32 class Insets; |
34 } | 33 } |
35 | 34 |
36 namespace ui { | 35 namespace ui { |
37 class ViewProp; | 36 class ViewProp; |
38 } | 37 } |
39 | 38 |
40 namespace views { | 39 namespace views { |
41 | 40 |
42 class FullscreenHandler; | 41 class FullscreenHandler; |
43 class HWNDMessageHandlerDelegate; | 42 class HWNDMessageHandlerDelegate; |
44 class InputMethod; | |
45 class WindowsSessionChangeObserver; | 43 class WindowsSessionChangeObserver; |
46 | 44 |
47 // These two messages aren't defined in winuser.h, but they are sent to windows | 45 // These two messages aren't defined in winuser.h, but they are sent to windows |
48 // with captions. They appear to paint the window caption and frame. | 46 // with captions. They appear to paint the window caption and frame. |
49 // Unfortunately if you override the standard non-client rendering as we do | 47 // Unfortunately if you override the standard non-client rendering as we do |
50 // with CustomFrameWindow, sometimes Windows (not deterministically | 48 // with CustomFrameWindow, sometimes Windows (not deterministically |
51 // reproducibly but definitely frequently) will send these messages to the | 49 // reproducibly but definitely frequently) will send these messages to the |
52 // window and paint the standard caption/title over the top of the custom one. | 50 // window and paint the standard caption/title over the top of the custom one. |
53 // So we need to handle these messages in CustomFrameWindow to prevent this | 51 // So we need to handle these messages in CustomFrameWindow to prevent this |
54 // from happening. | 52 // from happening. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 case 0: | 102 case 0: |
105 | 103 |
106 // An object that handles messages for a HWND that implements the views | 104 // An object that handles messages for a HWND that implements the views |
107 // "Custom Frame" look. The purpose of this class is to isolate the windows- | 105 // "Custom Frame" look. The purpose of this class is to isolate the windows- |
108 // specific message handling from the code that wraps it. It is intended to be | 106 // specific message handling from the code that wraps it. It is intended to be |
109 // used by both a views::NativeWidget and an aura::WindowTreeHost | 107 // used by both a views::NativeWidget and an aura::WindowTreeHost |
110 // implementation. | 108 // implementation. |
111 // TODO(beng): This object should eventually *become* the WindowImpl. | 109 // TODO(beng): This object should eventually *become* the WindowImpl. |
112 class VIEWS_EXPORT HWNDMessageHandler : | 110 class VIEWS_EXPORT HWNDMessageHandler : |
113 public gfx::WindowImpl, | 111 public gfx::WindowImpl, |
114 public internal::InputMethodDelegate, | |
115 public ui::WindowEventTarget { | 112 public ui::WindowEventTarget { |
116 public: | 113 public: |
117 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); | 114 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); |
118 ~HWNDMessageHandler() override; | 115 ~HWNDMessageHandler() override; |
119 | 116 |
120 void Init(HWND parent, const gfx::Rect& bounds); | 117 void Init(HWND parent, const gfx::Rect& bounds); |
121 void InitModalType(ui::ModalType modal_type); | 118 void InitModalType(ui::ModalType modal_type); |
122 | 119 |
123 void Close(); | 120 void Close(); |
124 void CloseNow(); | 121 void CloseNow(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 198 } |
202 | 199 |
203 void SetFullscreen(bool fullscreen); | 200 void SetFullscreen(bool fullscreen); |
204 | 201 |
205 // Updates the window style to reflect whether it can be resized or maximized. | 202 // Updates the window style to reflect whether it can be resized or maximized. |
206 void SizeConstraintsChanged(); | 203 void SizeConstraintsChanged(); |
207 | 204 |
208 private: | 205 private: |
209 typedef std::set<DWORD> TouchIDs; | 206 typedef std::set<DWORD> TouchIDs; |
210 | 207 |
211 // Overridden from internal::InputMethodDelegate: | |
212 void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; | |
213 | |
214 // Overridden from WindowImpl: | 208 // Overridden from WindowImpl: |
215 HICON GetDefaultWindowIcon() const override; | 209 HICON GetDefaultWindowIcon() const override; |
216 HICON GetSmallWindowIcon() const override; | 210 HICON GetSmallWindowIcon() const override; |
217 LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) override; | 211 LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) override; |
218 | 212 |
219 // Overridden from WindowEventTarget | 213 // Overridden from WindowEventTarget |
220 LRESULT HandleMouseMessage(unsigned int message, | 214 LRESULT HandleMouseMessage(unsigned int message, |
221 WPARAM w_param, | 215 WPARAM w_param, |
222 LPARAM l_param, | 216 LPARAM l_param, |
223 bool* handled) override; | 217 bool* handled) override; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 592 |
599 // The factory used with BEGIN_SAFE_MSG_MAP_EX. | 593 // The factory used with BEGIN_SAFE_MSG_MAP_EX. |
600 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; | 594 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; |
601 | 595 |
602 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); | 596 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); |
603 }; | 597 }; |
604 | 598 |
605 } // namespace views | 599 } // namespace views |
606 | 600 |
607 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 601 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
OLD | NEW |