OLD | NEW |
1 // Copyright (c) 2006-2008 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 "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 int i = 0; | 186 UINT 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 unsigned int rv = ::SendInput(i, input, sizeof(INPUT)); | 231 if (::SendInput(i, input, sizeof(INPUT)) != i) |
232 | |
233 if (rv != i) | |
234 return false; | 232 return false; |
235 | 233 |
236 if (dispatcher.get()) | 234 if (dispatcher.get()) |
237 dispatcher->AddRef(); | 235 dispatcher->AddRef(); |
238 return true; | 236 return true; |
239 } | 237 } |
240 | 238 |
241 bool SendMouseMoveImpl(long x, long y, Task* task) { | 239 bool SendMouseMoveImpl(long x, long y, Task* task) { |
242 // First check if the mouse is already there. | 240 // First check if the mouse is already there. |
243 POINT current_pos; | 241 POINT current_pos; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 int state, Task* task) { | 361 int state, Task* task) { |
364 DCHECK(view); | 362 DCHECK(view); |
365 DCHECK(view->GetWidget()); | 363 DCHECK(view->GetWidget()); |
366 gfx::Point view_center(view->width() / 2, view->height() / 2); | 364 gfx::Point view_center(view->width() / 2, view->height() / 2); |
367 views::View::ConvertPointToScreen(view, &view_center); | 365 views::View::ConvertPointToScreen(view, &view_center); |
368 SendMouseMove(view_center.x(), view_center.y()); | 366 SendMouseMove(view_center.x(), view_center.y()); |
369 SendMouseEventsNotifyWhenDone(button, state, task); | 367 SendMouseEventsNotifyWhenDone(button, state, task); |
370 } | 368 } |
371 | 369 |
372 } // ui_controls | 370 } // ui_controls |
OLD | NEW |