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 VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ | 5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ |
6 #define VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ | 6 #define VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <atlbase.h> | 9 #include <atlbase.h> |
10 #include <atlapp.h> | 10 #include <atlapp.h> |
11 #include <atlcrack.h> | 11 #include <atlcrack.h> |
12 #include <atlmisc.h> | 12 #include <atlmisc.h> |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/hash_tables.h" | |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
19 #include "base/memory/scoped_vector.h" | 20 #include "base/memory/scoped_vector.h" |
20 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
21 #include "base/message_loop.h" | 22 #include "base/message_loop.h" |
22 #include "base/win/scoped_comptr.h" | 23 #include "base/win/scoped_comptr.h" |
23 #include "base/win/win_util.h" | 24 #include "base/win/win_util.h" |
24 #include "ui/base/win/window_impl.h" | 25 #include "ui/base/win/window_impl.h" |
25 #include "ui/gfx/compositor/compositor.h" | 26 #include "ui/gfx/compositor/compositor.h" |
26 #include "views/focus/focus_manager.h" | 27 #include "views/focus/focus_manager.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 static gfx::Font GetWindowTitleFont(); | 96 static gfx::Font GetWindowTitleFont(); |
96 | 97 |
97 // Show the window with the specified show command. | 98 // Show the window with the specified show command. |
98 void Show(int show_state); | 99 void Show(int show_state); |
99 | 100 |
100 // Disable Layered Window updates by setting to false. | 101 // Disable Layered Window updates by setting to false. |
101 void set_can_update_layered_window(bool can_update_layered_window) { | 102 void set_can_update_layered_window(bool can_update_layered_window) { |
102 can_update_layered_window_ = can_update_layered_window; | 103 can_update_layered_window_ = can_update_layered_window; |
103 } | 104 } |
104 | 105 |
105 // Obtain the view event with the given MSAA child id. Used in | 106 // Obtain the view corresponding to a MSAA child id. Used in |
106 // NativeViewAccessibilityWin::get_accChild to support requests for | 107 // NativeViewAccessibilityWin::get_accChild to support requests for |
107 // children of windowless controls. May return NULL | 108 // children of windowless controls. May return NULL |
108 // (see ViewHierarchyChanged). | 109 // (see ViewHierarchyChanged). |
109 View* GetAccessibilityViewEventAt(int id); | 110 View* GetAccessibilityViewFromChildId(long id); |
sky
2011/10/25 20:08:45
How about naming this GetViewByAccessibleId().
I d
dmazzoni
2011/10/26 16:46:13
Sure - since the view hierarchy is pretty small, I
| |
110 | |
111 // Add a view that has recently fired an accessibility event. Returns a MSAA | |
112 // child id which is generated by: -(index of view in vector + 1) which | |
113 // guarantees a negative child id. This distinguishes the view from | |
114 // positive MSAA child id's which are direct leaf children of views that have | |
115 // associated hWnd's (e.g. NativeWidgetWin). | |
116 int AddAccessibilityViewEvent(View* view); | |
117 | |
118 // Clear a view that has recently been removed on a hierarchy change. | |
119 void ClearAccessibilityViewEvent(View* view); | |
120 | 111 |
121 // Hides the window if it hasn't already been force-hidden. The force hidden | 112 // Hides the window if it hasn't already been force-hidden. The force hidden |
122 // count is tracked, so calling multiple times is allowed, you just have to | 113 // count is tracked, so calling multiple times is allowed, you just have to |
123 // be sure to call PopForceHidden the same number of times. | 114 // be sure to call PopForceHidden the same number of times. |
124 void PushForceHidden(); | 115 void PushForceHidden(); |
125 | 116 |
126 // Decrements the force hidden count, showing the window if we have reached | 117 // Decrements the force hidden count, showing the window if we have reached |
127 // the top of the stack. See PushForceHidden. | 118 // the top of the stack. See PushForceHidden. |
128 void PopForceHidden(); | 119 void PopForceHidden(); |
129 | 120 |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 // Whether the focus should be restored next time we get enabled. Needed to | 579 // Whether the focus should be restored next time we get enabled. Needed to |
589 // restore focus correctly when Windows modal dialogs are displayed. | 580 // restore focus correctly when Windows modal dialogs are displayed. |
590 bool restore_focus_when_enabled_; | 581 bool restore_focus_when_enabled_; |
591 | 582 |
592 // Instance of accessibility information and handling for MSAA root | 583 // Instance of accessibility information and handling for MSAA root |
593 base::win::ScopedComPtr<IAccessible> accessibility_root_; | 584 base::win::ScopedComPtr<IAccessible> accessibility_root_; |
594 | 585 |
595 // Value determines whether the Widget is customized for accessibility. | 586 // Value determines whether the Widget is customized for accessibility. |
596 static bool screen_reader_active_; | 587 static bool screen_reader_active_; |
597 | 588 |
598 // The maximum number of view events in our vector below. | 589 // A map from a unique ID to a descendant view, for accessibility. |
599 static const int kMaxAccessibilityViewEvents = 20; | 590 base::hash_map<long, View*> accessibility_id_view_map_; |
600 | |
601 // A vector used to access views for which we have sent notifications to | |
602 // accessibility clients. It is used as a circular queue. | |
603 std::vector<View*> accessibility_view_events_; | |
604 | |
605 // The current position of the view events vector. When incrementing, | |
606 // we always mod this value with the max view events above . | |
607 int accessibility_view_events_index_; | |
608 | 591 |
609 // The last cursor that was active before the current one was selected. Saved | 592 // The last cursor that was active before the current one was selected. Saved |
610 // so that we can restore it. | 593 // so that we can restore it. |
611 gfx::NativeCursor previous_cursor_; | 594 gfx::NativeCursor previous_cursor_; |
612 | 595 |
613 ViewProps props_; | 596 ViewProps props_; |
614 | 597 |
615 // True if we're in fullscreen mode. | 598 // True if we're in fullscreen mode. |
616 bool fullscreen_; | 599 bool fullscreen_; |
617 | 600 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 // rather than asking the Widget for the non_client_view so that we know at | 649 // rather than asking the Widget for the non_client_view so that we know at |
667 // Init time, before the Widget has created the NonClientView. | 650 // Init time, before the Widget has created the NonClientView. |
668 bool has_non_client_view_; | 651 bool has_non_client_view_; |
669 | 652 |
670 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin); | 653 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin); |
671 }; | 654 }; |
672 | 655 |
673 } // namespace views | 656 } // namespace views |
674 | 657 |
675 #endif // VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ | 658 #endif // VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ |
OLD | NEW |