OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
6 #define CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
7 | 7 |
8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "chrome_frame/chrome_frame_automation.h" | 10 #include "chrome_frame/chrome_frame_automation.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return; | 100 return; |
101 } | 101 } |
102 | 102 |
103 // TrackPopupMenuEx call will fail on IE on Vista running | 103 // TrackPopupMenuEx call will fail on IE on Vista running |
104 // in low integrity mode. We DO seem to be able to enumerate the menu | 104 // in low integrity mode. We DO seem to be able to enumerate the menu |
105 // though, so just clone it and show the copy: | 105 // though, so just clone it and show the copy: |
106 HMENU copy = UtilCloneContextMenu(static_cast<HMENU>(menu_handle)); | 106 HMENU copy = UtilCloneContextMenu(static_cast<HMENU>(menu_handle)); |
107 if (!copy) | 107 if (!copy) |
108 return; | 108 return; |
109 | 109 |
110 T* pThis = static_cast<T*>(this); | 110 T* self = static_cast<T*>(this); |
111 if (pThis->PreProcessContextMenu(copy)) { | 111 if (self->PreProcessContextMenu(copy)) { |
| 112 // In order for the context menu to handle keyboard input, give the |
| 113 // ActiveX window focus. |
| 114 ignore_setfocus_ = true; |
| 115 SetFocus(GetWindow()); |
| 116 ignore_setfocus_ = false; |
112 UINT flags = align_flags | TPM_LEFTBUTTON | TPM_RETURNCMD | TPM_RECURSE; | 117 UINT flags = align_flags | TPM_LEFTBUTTON | TPM_RETURNCMD | TPM_RECURSE; |
113 UINT selected = TrackPopupMenuEx(copy, flags, params.screen_x, | 118 UINT selected = TrackPopupMenuEx(copy, flags, params.screen_x, |
114 params.screen_y, GetWindow(), NULL); | 119 params.screen_y, GetWindow(), NULL); |
115 if (selected != 0 && !pThis->HandleContextMenuCommand(selected, params)) { | 120 // Menu is over now give focus back to chrome |
| 121 GiveFocusToChrome(); |
| 122 if (selected != 0 && !self->HandleContextMenuCommand(selected, params)) { |
116 automation_client_->SendContextMenuCommandToChromeFrame(selected); | 123 automation_client_->SendContextMenuCommandToChromeFrame(selected); |
117 } | 124 } |
118 } | 125 } |
119 | 126 |
120 DestroyMenu(copy); | 127 DestroyMenu(copy); |
121 } | 128 } |
122 | 129 |
123 LRESULT OnSetFocus(UINT message, WPARAM wparam, LPARAM lparam, | 130 LRESULT OnSetFocus(UINT message, WPARAM wparam, LPARAM lparam, |
124 BOOL& handled) { // NO_LINT | 131 BOOL& handled) { // NO_LINT |
125 if (!ignore_setfocus_ && automation_client_ != NULL) { | 132 if (!ignore_setfocus_ && automation_client_ != NULL) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 223 |
217 // List of functions to enable for automation, or a single entry "*" to | 224 // List of functions to enable for automation, or a single entry "*" to |
218 // enable all functions for automation. Ignored unless is_privileged_ is | 225 // enable all functions for automation. Ignored unless is_privileged_ is |
219 // true. Defaults to the empty list, meaning automation will not be | 226 // true. Defaults to the empty list, meaning automation will not be |
220 // turned on. | 227 // turned on. |
221 std::vector<std::string> functions_enabled_; | 228 std::vector<std::string> functions_enabled_; |
222 }; | 229 }; |
223 | 230 |
224 #endif // CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 231 #endif // CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
225 | 232 |
OLD | NEW |