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

Side by Side Diff: ui/views/win/hwnd_message_handler.h

Issue 2852763002: Added a system caret used for accessibility on Windows. (Closed)
Patch Set: Disabled all tests Created 3 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
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_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 AXSystemCaretWin;
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 bHandled; \ 114 bHandled; \
111 switch(dwMsgMapID) { \ 115 switch(dwMsgMapID) { \
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 : public gfx::WindowImpl,
121 public gfx::WindowImpl, 125 public ui::InputMethodObserver,
122 public ui::WindowEventTarget { 126 public ui::WindowEventTarget {
123 public: 127 public:
124 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); 128 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate);
125 ~HWNDMessageHandler() override; 129 ~HWNDMessageHandler() override;
126 130
127 void Init(HWND parent, const gfx::Rect& bounds); 131 void Init(HWND parent, const gfx::Rect& bounds);
128 void InitModalType(ui::ModalType modal_type); 132 void InitModalType(ui::ModalType modal_type);
129 133
130 void Close(); 134 void Close();
131 void CloseNow(); 135 void CloseNow();
132 136
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 224
221 private: 225 private:
222 typedef std::set<DWORD> TouchIDs; 226 typedef std::set<DWORD> TouchIDs;
223 enum class DwmFrameState { OFF, ON }; 227 enum class DwmFrameState { OFF, ON };
224 228
225 // Overridden from WindowImpl: 229 // Overridden from WindowImpl:
226 HICON GetDefaultWindowIcon() const override; 230 HICON GetDefaultWindowIcon() const override;
227 HICON GetSmallWindowIcon() const override; 231 HICON GetSmallWindowIcon() const override;
228 LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) override; 232 LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) override;
229 233
234 // Overridden from InputMethodObserver
235 void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
236 void OnFocus() override;
237 void OnBlur() override;
238 void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
239 void OnTextInputStateChanged(const ui::TextInputClient* client) override;
240 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override;
241 void OnShowImeIfNeeded() override;
242
230 // Overridden from WindowEventTarget 243 // Overridden from WindowEventTarget
231 LRESULT HandleMouseMessage(unsigned int message, 244 LRESULT HandleMouseMessage(unsigned int message,
232 WPARAM w_param, 245 WPARAM w_param,
233 LPARAM l_param, 246 LPARAM l_param,
234 bool* handled) override; 247 bool* handled) override;
235 LRESULT HandleKeyboardMessage(unsigned int message, 248 LRESULT HandleKeyboardMessage(unsigned int message,
236 WPARAM w_param, 249 WPARAM w_param,
237 LPARAM l_param, 250 LPARAM l_param,
238 bool* handled) override; 251 bool* handled) override;
239 LRESULT HandleTouchMessage(unsigned int message, 252 LRESULT HandleTouchMessage(unsigned int message,
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // Checks if there is a full screen window on the same monitor as the 580 // Checks if there is a full screen window on the same monitor as the
568 // |window| which is becoming active. If yes then we reduce the size of the 581 // |window| which is becoming active. If yes then we reduce the size of the
569 // fullscreen window by 1 px to ensure that maximized windows on the same 582 // fullscreen window by 1 px to ensure that maximized windows on the same
570 // monitor don't draw over the taskbar. 583 // monitor don't draw over the taskbar.
571 void CheckAndHandleBackgroundFullscreenOnMonitor(HWND window); 584 void CheckAndHandleBackgroundFullscreenOnMonitor(HWND window);
572 585
573 // Provides functionality to reduce the bounds of the fullscreen window by 1 586 // Provides functionality to reduce the bounds of the fullscreen window by 1
574 // px on activation loss to a window on the same monitor. 587 // px on activation loss to a window on the same monitor.
575 void OnBackgroundFullscreen(); 588 void OnBackgroundFullscreen();
576 589
590 // Deletes the system caret used for accessibility. This will result in any
591 // clients that are still holding onto its |IAccessible| to get a failure code
592 // if they request its location.
593 void DestroyAXSystemCaret();
594
577 HWNDMessageHandlerDelegate* delegate_; 595 HWNDMessageHandlerDelegate* delegate_;
578 596
579 std::unique_ptr<FullscreenHandler> fullscreen_handler_; 597 std::unique_ptr<FullscreenHandler> fullscreen_handler_;
580 598
581 // Set to true in Close() and false is CloseNow(). 599 // Set to true in Close() and false is CloseNow().
582 bool waiting_for_close_now_; 600 bool waiting_for_close_now_;
583 601
584 bool use_system_default_icon_; 602 bool use_system_default_icon_;
585 603
586 // Whether all ancestors have been enabled. This is only used if is_modal_ is 604 // Whether all ancestors have been enabled. This is only used if is_modal_ is
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 bool sent_window_size_changing_; 709 bool sent_window_size_changing_;
692 710
693 // This is used to keep track of whether a WM_WINDOWPOSCHANGED has 711 // This is used to keep track of whether a WM_WINDOWPOSCHANGED has
694 // been received after the WM_WINDOWPOSCHANGING. 712 // been received after the WM_WINDOWPOSCHANGING.
695 uint32_t current_window_size_message_ = 0; 713 uint32_t current_window_size_message_ = 0;
696 714
697 // Manages observation of Windows Session Change messages. 715 // Manages observation of Windows Session Change messages.
698 std::unique_ptr<WindowsSessionChangeObserver> 716 std::unique_ptr<WindowsSessionChangeObserver>
699 windows_session_change_observer_; 717 windows_session_change_observer_;
700 718
719 // Some assistive software need to track the location of the caret.
720 std::unique_ptr<ui::AXSystemCaretWin> ax_system_caret_;
721
701 // This class provides functionality to register the legacy window as a 722 // This class provides functionality to register the legacy window as a
702 // Direct Manipulation consumer. This allows us to support smooth scroll 723 // Direct Manipulation consumer. This allows us to support smooth scroll
703 // in Chrome on Windows 10. 724 // in Chrome on Windows 10.
704 std::unique_ptr<gfx::win::DirectManipulationHelper> 725 std::unique_ptr<gfx::win::DirectManipulationHelper>
705 direct_manipulation_helper_; 726 direct_manipulation_helper_;
706 727
707 // The location where the user clicked on the caption. We cache this when we 728 // The location where the user clicked on the caption. We cache this when we
708 // receive the WM_NCLBUTTONDOWN message. We use this in the subsequent 729 // receive the WM_NCLBUTTONDOWN message. We use this in the subsequent
709 // WM_NCMOUSEMOVE message to see if the mouse actually moved. 730 // WM_NCMOUSEMOVE message to see if the mouse actually moved.
710 // Please refer to the HandleMouseEventInternal function for details on why 731 // Please refer to the HandleMouseEventInternal function for details on why
(...skipping 27 matching lines...) Expand all
738 759
739 // The factory used with BEGIN_SAFE_MSG_MAP_EX. 760 // The factory used with BEGIN_SAFE_MSG_MAP_EX.
740 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; 761 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_;
741 762
742 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); 763 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler);
743 }; 764 };
744 765
745 } // namespace views 766 } // namespace views
746 767
747 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ 768 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ('k') | ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698