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

Side by Side Diff: views/view_win.cc

Issue 3015026: Add initial tests for keyboard access (tabbing in some dialogs).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « views/view_unittest.cc ('k') | views/views_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "views/view.h" 5 #include "views/view.h"
6 6
7 #include "app/drag_drop_types.h" 7 #include "app/drag_drop_types.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "gfx/canvas.h" 9 #include "gfx/canvas.h"
10 #include "gfx/path.h" 10 #include "gfx/path.h"
11 #include "views/accessibility/view_accessibility.h" 11 #include "views/accessibility/view_accessibility.h"
12 #include "views/accessibility/view_accessibility_wrapper.h" 12 #include "views/accessibility/view_accessibility_wrapper.h"
13 #include "views/border.h" 13 #include "views/border.h"
14 #include "views/views_delegate.h"
14 #include "views/widget/root_view.h" 15 #include "views/widget/root_view.h"
15 #include "views/widget/widget.h" 16 #include "views/widget/widget.h"
16 #include "views/widget/widget_win.h" 17 #include "views/widget/widget_win.h"
17 18
18 namespace views { 19 namespace views {
19 20
20 // static 21 // static
21 int View::GetDoubleClickTimeMS() { 22 int View::GetDoubleClickTimeMS() {
22 return ::GetDoubleClickTime(); 23 return ::GetDoubleClickTime();
23 } 24 }
24 25
25 // static 26 // static
26 int View::GetMenuShowDelay() { 27 int View::GetMenuShowDelay() {
27 static DWORD delay = 0; 28 static DWORD delay = 0;
28 if (!delay && !SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) 29 if (!delay && !SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0))
29 delay = View::kShowFolderDropMenuDelay; 30 delay = View::kShowFolderDropMenuDelay;
30 return delay; 31 return delay;
31 } 32 }
32 33
33 // Notifies accessibility clients of the event_type on this view.
34 // Clients will call get_accChild found in ViewAccessibility with the supplied
35 // child id we generate here to retrieve the IAccessible associated with this
36 // view.
37 void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { 34 void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) {
38 WidgetWin* view_widget = static_cast<WidgetWin*>(GetWidget()); 35 NotifyAccessibilityEvent(event_type, true);
39 int child_id = view_widget->AddAccessibilityViewEvent(this); 36 }
40 ::NotifyWinEvent(ViewAccessibility::MSAAEvent(event_type), 37
41 view_widget->GetNativeView(), OBJID_CLIENT, child_id); 38 void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type,
39 bool send_native_event) {
40 // Send the notification to the delegate.
41 if (ViewsDelegate::views_delegate)
42 ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type);
43
44 // Now call the Windows-specific method to notify MSAA clients of this
45 // event. The widget gives us a temporary unique child ID to associate
46 // with this view so that clients can call get_accChild in ViewAccessibility
47 // to retrieve the IAccessible associated with this view.
48 if (send_native_event) {
49 WidgetWin* view_widget = static_cast<WidgetWin*>(GetWidget());
50 int child_id = view_widget->AddAccessibilityViewEvent(this);
51 ::NotifyWinEvent(ViewAccessibility::MSAAEvent(event_type),
52 view_widget->GetNativeView(), OBJID_CLIENT, child_id);
53 }
42 } 54 }
43 55
44 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() { 56 ViewAccessibilityWrapper* View::GetViewAccessibilityWrapper() {
45 if (accessibility_.get() == NULL) { 57 if (accessibility_.get() == NULL) {
46 accessibility_.reset(new ViewAccessibilityWrapper(this)); 58 accessibility_.reset(new ViewAccessibilityWrapper(this));
47 } 59 }
48 return accessibility_.get(); 60 return accessibility_.get();
49 } 61 }
50 62
51 int View::GetHorizontalDragThreshold() { 63 int View::GetHorizontalDragThreshold() {
52 static int threshold = -1; 64 static int threshold = -1;
53 if (threshold == -1) 65 if (threshold == -1)
54 threshold = GetSystemMetrics(SM_CXDRAG) / 2; 66 threshold = GetSystemMetrics(SM_CXDRAG) / 2;
55 return threshold; 67 return threshold;
56 } 68 }
57 69
58 int View::GetVerticalDragThreshold() { 70 int View::GetVerticalDragThreshold() {
59 static int threshold = -1; 71 static int threshold = -1;
60 if (threshold == -1) 72 if (threshold == -1)
61 threshold = GetSystemMetrics(SM_CYDRAG) / 2; 73 threshold = GetSystemMetrics(SM_CYDRAG) / 2;
62 return threshold; 74 return threshold;
63 } 75 }
64 76
65 } // namespace views 77 } // namespace views
OLDNEW
« no previous file with comments | « views/view_unittest.cc ('k') | views/views_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698