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 #include "ui/views/controls/native_control_win.h" | 5 #include "ui/views/controls/native_control_win.h" |
6 | 6 |
7 #include <windowsx.h> | 7 #include <windowsx.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/base/accessibility/accessibility_types.h" | 10 #include "ui/base/accessibility/accessibility_types.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 ui::AccessibilityTypes::EVENT_FOCUS, send_native_event); | 117 ui::AccessibilityTypes::EVENT_FOCUS, send_native_event); |
118 } | 118 } |
119 | 119 |
120 //////////////////////////////////////////////////////////////////////////////// | 120 //////////////////////////////////////////////////////////////////////////////// |
121 // NativeControlWin, protected: | 121 // NativeControlWin, protected: |
122 | 122 |
123 void NativeControlWin::ShowContextMenu(const gfx::Point& location) { | 123 void NativeControlWin::ShowContextMenu(const gfx::Point& location) { |
124 if (!context_menu_controller()) | 124 if (!context_menu_controller()) |
125 return; | 125 return; |
126 | 126 |
127 if (location.x() == -1 && location.y() == -1) | 127 if (location.x() == -1 && location.y() == -1) { |
128 View::ShowContextMenu(GetKeyboardContextMenuLocation(), false); | 128 View::ShowContextMenu(GetKeyboardContextMenuLocation(), |
129 else | 129 ui::MENU_SOURCE_KEYBOARD); |
130 View::ShowContextMenu(location, true); | 130 } else { |
| 131 View::ShowContextMenu(location, ui::MENU_SOURCE_MOUSE); |
| 132 } |
131 } | 133 } |
132 | 134 |
133 void NativeControlWin::NativeControlCreated(HWND native_control) { | 135 void NativeControlWin::NativeControlCreated(HWND native_control) { |
134 // Associate this object with the control's HWND so that NativeWidgetWin can | 136 // Associate this object with the control's HWND so that NativeWidgetWin can |
135 // find this object when it receives messages from it. | 137 // find this object when it receives messages from it. |
136 props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this)); | 138 props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this)); |
137 props_.push_back(ChildWindowMessageProcessor::Register(native_control, this)); | 139 props_.push_back(ChildWindowMessageProcessor::Register(native_control, this)); |
138 | 140 |
139 // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages. | 141 // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages. |
140 original_wndproc_ = ui::SetWindowProc( | 142 original_wndproc_ = ui::SetWindowProc( |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } else if (message == WM_DESTROY) { | 217 } else if (message == WM_DESTROY) { |
216 native_control->props_.clear(); | 218 native_control->props_.clear(); |
217 ui::SetWindowProc(window, native_control->original_wndproc_); | 219 ui::SetWindowProc(window, native_control->original_wndproc_); |
218 } | 220 } |
219 | 221 |
220 return CallWindowProc(native_control->original_wndproc_, window, message, | 222 return CallWindowProc(native_control->original_wndproc_, window, message, |
221 w_param, l_param); | 223 w_param, l_param); |
222 } | 224 } |
223 | 225 |
224 } // namespace views | 226 } // namespace views |
OLD | NEW |