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 <stddef.h> | 10 #include <stddef.h> |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <set> | 13 #include <set> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/win/scoped_gdi_object.h" | 21 #include "base/win/scoped_gdi_object.h" |
22 #include "base/win/win_util.h" | 22 #include "base/win/win_util.h" |
23 #include "ui/accessibility/ax_enums.h" | 23 #include "ui/accessibility/ax_enums.h" |
24 #include "ui/base/ime/input_method_observer.h" | |
24 #include "ui/base/ui_base_types.h" | 25 #include "ui/base/ui_base_types.h" |
25 #include "ui/base/win/window_event_target.h" | 26 #include "ui/base/win/window_event_target.h" |
26 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
27 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
28 #include "ui/gfx/sequential_id_generator.h" | 29 #include "ui/gfx/sequential_id_generator.h" |
29 #include "ui/gfx/win/window_impl.h" | 30 #include "ui/gfx/win/window_impl.h" |
30 #include "ui/views/views_export.h" | 31 #include "ui/views/views_export.h" |
31 | 32 |
32 namespace gfx { | 33 namespace gfx { |
33 class ImageSkia; | 34 class ImageSkia; |
34 class Insets; | 35 class Insets; |
35 namespace win { | 36 namespace win { |
36 class DirectManipulationHelper; | 37 class DirectManipulationHelper; |
37 } // namespace win | 38 } // namespace win |
38 } // namespace gfx | 39 } // namespace gfx |
39 | 40 |
40 namespace ui { | 41 namespace ui { |
42 class AXFakeCaretWin; | |
43 class InputMethod; | |
44 class TextInputClient; | |
41 class ViewProp; | 45 class ViewProp; |
42 } | 46 } |
43 | 47 |
44 namespace views { | 48 namespace views { |
45 | 49 |
46 class FullscreenHandler; | 50 class FullscreenHandler; |
47 class HWNDMessageHandlerDelegate; | 51 class HWNDMessageHandlerDelegate; |
48 class WindowsSessionChangeObserver; | 52 class WindowsSessionChangeObserver; |
49 | 53 |
50 // These two messages aren't defined in winuser.h, but they are sent to windows | 54 // These two messages aren't defined in winuser.h, but they are sent to windows |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 case 0: | 116 case 0: |
113 | 117 |
114 // An object that handles messages for a HWND that implements the views | 118 // An object that handles messages for a HWND that implements the views |
115 // "Custom Frame" look. The purpose of this class is to isolate the windows- | 119 // "Custom Frame" look. The purpose of this class is to isolate the windows- |
116 // specific message handling from the code that wraps it. It is intended to be | 120 // specific message handling from the code that wraps it. It is intended to be |
117 // used by both a views::NativeWidget and an aura::WindowTreeHost | 121 // used by both a views::NativeWidget and an aura::WindowTreeHost |
118 // implementation. | 122 // implementation. |
119 // TODO(beng): This object should eventually *become* the WindowImpl. | 123 // TODO(beng): This object should eventually *become* the WindowImpl. |
120 class VIEWS_EXPORT HWNDMessageHandler : | 124 class VIEWS_EXPORT HWNDMessageHandler : |
121 public gfx::WindowImpl, | 125 public gfx::WindowImpl, |
126 public ui::InputMethodObserver, | |
122 public ui::WindowEventTarget { | 127 public ui::WindowEventTarget { |
123 public: | 128 public: |
124 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); | 129 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); |
125 ~HWNDMessageHandler() override; | 130 ~HWNDMessageHandler() override; |
126 | 131 |
127 void Init(HWND parent, const gfx::Rect& bounds); | 132 void Init(HWND parent, const gfx::Rect& bounds); |
128 void InitModalType(ui::ModalType modal_type); | 133 void InitModalType(ui::ModalType modal_type); |
129 | 134 |
130 void Close(); | 135 void Close(); |
131 void CloseNow(); | 136 void CloseNow(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 | 220 |
216 private: | 221 private: |
217 typedef std::set<DWORD> TouchIDs; | 222 typedef std::set<DWORD> TouchIDs; |
218 enum class DwmFrameState { OFF, ON }; | 223 enum class DwmFrameState { OFF, ON }; |
219 | 224 |
220 // Overridden from WindowImpl: | 225 // Overridden from WindowImpl: |
221 HICON GetDefaultWindowIcon() const override; | 226 HICON GetDefaultWindowIcon() const override; |
222 HICON GetSmallWindowIcon() const override; | 227 HICON GetSmallWindowIcon() const override; |
223 LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) override; | 228 LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) override; |
224 | 229 |
230 // Overridden from InputMethodObserver | |
231 void OnTextInputTypeChanged(const TextInputClient* client) override {} | |
dmazzoni
2017/04/27 05:07:32
You should handle this in order to handle the case
| |
232 void OnFocus() override {} | |
233 void OnBlur() override {} | |
234 void OnCaretBoundsChanged(const TextInputClient* client) override; | |
235 void OnTextInputStateChanged(const TextInputClient* client) override; | |
236 void OnInputMethodDestroyed(const InputMethod* input_method) override; | |
dmazzoni
2017/04/27 05:07:32
Possibly this too.
See chrome/browser/chromeos/ac
| |
237 void OnShowImeIfNeeded() override {} | |
238 | |
225 // Overridden from WindowEventTarget | 239 // Overridden from WindowEventTarget |
226 LRESULT HandleMouseMessage(unsigned int message, | 240 LRESULT HandleMouseMessage(unsigned int message, |
227 WPARAM w_param, | 241 WPARAM w_param, |
228 LPARAM l_param, | 242 LPARAM l_param, |
229 bool* handled) override; | 243 bool* handled) override; |
230 LRESULT HandleKeyboardMessage(unsigned int message, | 244 LRESULT HandleKeyboardMessage(unsigned int message, |
231 WPARAM w_param, | 245 WPARAM w_param, |
232 LPARAM l_param, | 246 LPARAM l_param, |
233 bool* handled) override; | 247 bool* handled) override; |
234 LRESULT HandleTouchMessage(unsigned int message, | 248 LRESULT HandleTouchMessage(unsigned int message, |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 bool sent_window_size_changing_; | 692 bool sent_window_size_changing_; |
679 | 693 |
680 // This is used to keep track of whether a WM_WINDOWPOSCHANGED has | 694 // This is used to keep track of whether a WM_WINDOWPOSCHANGED has |
681 // been received after the WM_WINDOWPOSCHANGING. | 695 // been received after the WM_WINDOWPOSCHANGING. |
682 uint32_t current_window_size_message_ = 0; | 696 uint32_t current_window_size_message_ = 0; |
683 | 697 |
684 // Manages observation of Windows Session Change messages. | 698 // Manages observation of Windows Session Change messages. |
685 std::unique_ptr<WindowsSessionChangeObserver> | 699 std::unique_ptr<WindowsSessionChangeObserver> |
686 windows_session_change_observer_; | 700 windows_session_change_observer_; |
687 | 701 |
702 // Some assistive software need to track the location of the caret. | |
703 std::unique_ptr<ui::AXFakeCaretWin> ax_fake_caret_; | |
704 | |
688 // This class provides functionality to register the legacy window as a | 705 // This class provides functionality to register the legacy window as a |
689 // Direct Manipulation consumer. This allows us to support smooth scroll | 706 // Direct Manipulation consumer. This allows us to support smooth scroll |
690 // in Chrome on Windows 10. | 707 // in Chrome on Windows 10. |
691 std::unique_ptr<gfx::win::DirectManipulationHelper> | 708 std::unique_ptr<gfx::win::DirectManipulationHelper> |
692 direct_manipulation_helper_; | 709 direct_manipulation_helper_; |
693 | 710 |
694 // The location where the user clicked on the caption. We cache this when we | 711 // The location where the user clicked on the caption. We cache this when we |
695 // receive the WM_NCLBUTTONDOWN message. We use this in the subsequent | 712 // receive the WM_NCLBUTTONDOWN message. We use this in the subsequent |
696 // WM_NCMOUSEMOVE message to see if the mouse actually moved. | 713 // WM_NCMOUSEMOVE message to see if the mouse actually moved. |
697 // Please refer to the HandleMouseEventInternal function for details on why | 714 // Please refer to the HandleMouseEventInternal function for details on why |
(...skipping 23 matching lines...) Expand all Loading... | |
721 | 738 |
722 // The factory used with BEGIN_SAFE_MSG_MAP_EX. | 739 // The factory used with BEGIN_SAFE_MSG_MAP_EX. |
723 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; | 740 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; |
724 | 741 |
725 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); | 742 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); |
726 }; | 743 }; |
727 | 744 |
728 } // namespace views | 745 } // namespace views |
729 | 746 |
730 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 747 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
OLD | NEW |