| OLD | NEW |
| 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/controls/native_control_win.h" | 5 #include "views/controls/native_control_win.h" |
| 6 | 6 |
| 7 #include <windowsx.h> | 7 #include <windowsx.h> |
| 8 | 8 |
| 9 #include "app/l10n_util_win.h" | 9 #include "app/l10n_util_win.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 void NativeControlWin::Focus() { | 96 void NativeControlWin::Focus() { |
| 97 DCHECK(native_view()); | 97 DCHECK(native_view()); |
| 98 SetFocus(native_view()); | 98 SetFocus(native_view()); |
| 99 | 99 |
| 100 // Since we are being wrapped by a view, accessibility should receive | 100 // Since we are being wrapped by a view, accessibility should receive |
| 101 // the super class as the focused view. | 101 // the super class as the focused view. |
| 102 View* parent_view = GetParent(); | 102 View* parent_view = GetParent(); |
| 103 | 103 |
| 104 // Due to some controls not behaving as expected without having | 104 // Due to some controls not behaving as expected without having |
| 105 // a native win32 control, we exclude the following from sending | 105 // a native win32 control, we don't always send a native (MSAA) |
| 106 // their IAccessible as focus events. | 106 // focus notification. |
| 107 if (parent_view->GetClassName() != views::Combobox::kViewClassName && | 107 bool send_native_event = |
| 108 parent_view->HasFocus()) | 108 parent_view->GetClassName() != views::Combobox::kViewClassName && |
| 109 parent_view->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS); | 109 parent_view->HasFocus(); |
| 110 |
| 111 // Send the accessibility focus notification. |
| 112 parent_view->NotifyAccessibilityEvent(AccessibilityTypes::EVENT_FOCUS, |
| 113 send_native_event); |
| 110 } | 114 } |
| 111 | 115 |
| 112 //////////////////////////////////////////////////////////////////////////////// | 116 //////////////////////////////////////////////////////////////////////////////// |
| 113 // NativeControlWin, protected: | 117 // NativeControlWin, protected: |
| 114 | 118 |
| 115 void NativeControlWin::ShowContextMenu(const gfx::Point& location) { | 119 void NativeControlWin::ShowContextMenu(const gfx::Point& location) { |
| 116 if (!GetContextMenuController()) | 120 if (!GetContextMenuController()) |
| 117 return; | 121 return; |
| 118 | 122 |
| 119 if (location.x() == -1 && location.y() == -1) | 123 if (location.x() == -1 && location.y() == -1) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 211 } |
| 208 } else if (message == WM_DESTROY) { | 212 } else if (message == WM_DESTROY) { |
| 209 win_util::SetWindowProc(window, native_control->original_wndproc_); | 213 win_util::SetWindowProc(window, native_control->original_wndproc_); |
| 210 } | 214 } |
| 211 | 215 |
| 212 return CallWindowProc(native_control->original_wndproc_, window, message, | 216 return CallWindowProc(native_control->original_wndproc_, window, message, |
| 213 w_param, l_param); | 217 w_param, l_param); |
| 214 } | 218 } |
| 215 | 219 |
| 216 } // namespace views | 220 } // namespace views |
| OLD | NEW |