OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/automation/ui_controls.h" | 5 #include "chrome/browser/automation/ui_controls.h" |
6 | 6 |
7 #include "base/keyboard_codes.h" | 7 #include "base/keyboard_codes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/win_util.h" | 10 #include "base/win_util.h" |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 ::SendMessage(popup_menu, WM_KEYDOWN, w_param, l_param); | 176 ::SendMessage(popup_menu, WM_KEYDOWN, w_param, l_param); |
177 ::SendMessage(popup_menu, WM_KEYUP, w_param, l_param); | 177 ::SendMessage(popup_menu, WM_KEYUP, w_param, l_param); |
178 | 178 |
179 if (dispatcher.get()) | 179 if (dispatcher.get()) |
180 dispatcher->AddRef(); | 180 dispatcher->AddRef(); |
181 return true; | 181 return true; |
182 } | 182 } |
183 | 183 |
184 INPUT input[8] = { 0 }; // 8, assuming all the modifiers are activated | 184 INPUT input[8] = { 0 }; // 8, assuming all the modifiers are activated |
185 | 185 |
186 UINT i = 0; | 186 int i = 0; |
187 if (control) { | 187 if (control) { |
188 if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], false)) | 188 if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], false)) |
189 return false; | 189 return false; |
190 i++; | 190 i++; |
191 } | 191 } |
192 | 192 |
193 if (shift) { | 193 if (shift) { |
194 if (!FillKeyboardInput(base::VKEY_SHIFT, &input[i], false)) | 194 if (!FillKeyboardInput(base::VKEY_SHIFT, &input[i], false)) |
195 return false; | 195 return false; |
196 i++; | 196 i++; |
(...skipping 24 matching lines...) Expand all Loading... |
221 return false; | 221 return false; |
222 i++; | 222 i++; |
223 } | 223 } |
224 | 224 |
225 if (control) { | 225 if (control) { |
226 if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], true)) | 226 if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], true)) |
227 return false; | 227 return false; |
228 i++; | 228 i++; |
229 } | 229 } |
230 | 230 |
231 if (::SendInput(i, input, sizeof(INPUT) != i)) | 231 unsigned int rv = ::SendInput(i, input, sizeof(INPUT)); |
| 232 |
| 233 if (rv != i) |
232 return false; | 234 return false; |
233 | 235 |
234 if (dispatcher.get()) | 236 if (dispatcher.get()) |
235 dispatcher->AddRef(); | 237 dispatcher->AddRef(); |
236 return true; | 238 return true; |
237 } | 239 } |
238 | 240 |
239 bool SendMouseMoveImpl(long x, long y, Task* task) { | 241 bool SendMouseMoveImpl(long x, long y, Task* task) { |
240 // First check if the mouse is already there. | 242 // First check if the mouse is already there. |
241 POINT current_pos; | 243 POINT current_pos; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 int state, Task* task) { | 363 int state, Task* task) { |
362 DCHECK(view); | 364 DCHECK(view); |
363 DCHECK(view->GetWidget()); | 365 DCHECK(view->GetWidget()); |
364 gfx::Point view_center(view->width() / 2, view->height() / 2); | 366 gfx::Point view_center(view->width() / 2, view->height() / 2); |
365 views::View::ConvertPointToScreen(view, &view_center); | 367 views::View::ConvertPointToScreen(view, &view_center); |
366 SendMouseMove(view_center.x(), view_center.y()); | 368 SendMouseMove(view_center.x(), view_center.y()); |
367 SendMouseEventsNotifyWhenDone(button, state, task); | 369 SendMouseEventsNotifyWhenDone(button, state, task); |
368 } | 370 } |
369 | 371 |
370 } // ui_controls | 372 } // ui_controls |
OLD | NEW |