Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: webkit/tools/test_shell/event_sending_controller.cc

Issue 3361003: Revert 58215 - Revert 58186 - Move the keyboard files from base/ to app/.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/webkit_support.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file contains the definition for EventSendingController. 5 // This file contains the definition for EventSendingController.
6 // 6 //
7 // Some notes about drag and drop handling: 7 // Some notes about drag and drop handling:
8 // Windows drag and drop goes through a system call to DoDragDrop. At that 8 // Windows drag and drop goes through a system call to DoDragDrop. At that
9 // point, program control is given to Windows which then periodically makes 9 // point, program control is given to Windows which then periodically makes
10 // callbacks into the webview. This won't work for layout tests, so instead, 10 // callbacks into the webview. This won't work for layout tests, so instead,
11 // we queue up all the mouse move and mouse up events. When the test tries to 11 // we queue up all the mouse move and mouse up events. When the test tries to
12 // start a drag (by calling EvenSendingController::DoDragDrop), we take the 12 // start a drag (by calling EvenSendingController::DoDragDrop), we take the
13 // events in the queue and replay them. 13 // events in the queue and replay them.
14 // The behavior of queuing events and replaying them can be disabled by a 14 // The behavior of queuing events and replaying them can be disabled by a
15 // layout test by setting eventSender.dragMode to false. 15 // layout test by setting eventSender.dragMode to false.
16 16
17 #include "webkit/tools/test_shell/event_sending_controller.h" 17 #include "webkit/tools/test_shell/event_sending_controller.h"
18 18
19 #include <queue> 19 #include <queue>
20 #include <vector> 20 #include <vector>
21 21
22 #include "app/keyboard_codes.h"
22 #include "base/compiler_specific.h" 23 #include "base/compiler_specific.h"
23 #include "base/file_path.h" 24 #include "base/file_path.h"
24 #include "base/file_util.h" 25 #include "base/file_util.h"
25 #include "base/keyboard_codes.h"
26 #include "base/logging.h" 26 #include "base/logging.h"
27 #include "base/message_loop.h" 27 #include "base/message_loop.h"
28 #include "base/time.h" 28 #include "base/time.h"
29 #include "base/string_number_conversions.h" 29 #include "base/string_number_conversions.h"
30 #include "base/string_util.h" 30 #include "base/string_util.h"
31 #include "base/utf_string_conversions.h" 31 #include "base/utf_string_conversions.h"
32 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" 32 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
33 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" 33 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
34 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h" 34 #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
35 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 35 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // modifiers. These key events correspond to some special movement and 210 // modifiers. These key events correspond to some special movement and
211 // selection editor commands, and was supposed to be handled in 211 // selection editor commands, and was supposed to be handled in
212 // third_party/WebKit/WebKit/chromium/src/EditorClientImpl.cpp. But these keys 212 // third_party/WebKit/WebKit/chromium/src/EditorClientImpl.cpp. But these keys
213 // will be marked as system key, which prevents them from being handled. 213 // will be marked as system key, which prevents them from being handled.
214 // Thus they must be handled specially. 214 // Thus they must be handled specially.
215 if ((event.modifiers & ~WebKeyboardEvent::ShiftKey) != 215 if ((event.modifiers & ~WebKeyboardEvent::ShiftKey) !=
216 WebKeyboardEvent::MetaKey) 216 WebKeyboardEvent::MetaKey)
217 return false; 217 return false;
218 218
219 switch (event.windowsKeyCode) { 219 switch (event.windowsKeyCode) {
220 case base::VKEY_LEFT: 220 case app::VKEY_LEFT:
221 *name = "MoveToBeginningOfLine"; 221 *name = "MoveToBeginningOfLine";
222 break; 222 break;
223 case base::VKEY_RIGHT: 223 case app::VKEY_RIGHT:
224 *name = "MoveToEndOfLine"; 224 *name = "MoveToEndOfLine";
225 break; 225 break;
226 case base::VKEY_UP: 226 case app::VKEY_UP:
227 *name = "MoveToBeginningOfDocument"; 227 *name = "MoveToBeginningOfDocument";
228 break; 228 break;
229 case base::VKEY_DOWN: 229 case app::VKEY_DOWN:
230 *name = "MoveToEndOfDocument"; 230 *name = "MoveToEndOfDocument";
231 break; 231 break;
232 default: 232 default:
233 return false; 233 return false;
234 } 234 }
235 235
236 if (event.modifiers & WebKeyboardEvent::ShiftKey) 236 if (event.modifiers & WebKeyboardEvent::ShiftKey)
237 name->append("AndModifySelection"); 237 name->append("AndModifySelection");
238 238
239 return true; 239 return true;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 // TODO(mpcomplete): Should we also generate a KEY_UP? 530 // TODO(mpcomplete): Should we also generate a KEY_UP?
531 std::wstring code_str = UTF8ToWide(args[0].ToString()); 531 std::wstring code_str = UTF8ToWide(args[0].ToString());
532 532
533 // Convert \n -> VK_RETURN. Some layout tests use \n to mean "Enter", when 533 // Convert \n -> VK_RETURN. Some layout tests use \n to mean "Enter", when
534 // Windows uses \r for "Enter". 534 // Windows uses \r for "Enter".
535 int code = 0; 535 int code = 0;
536 int text = 0; 536 int text = 0;
537 bool needs_shift_key_modifier = false; 537 bool needs_shift_key_modifier = false;
538 if (L"\n" == code_str) { 538 if (L"\n" == code_str) {
539 generate_char = true; 539 generate_char = true;
540 text = code = base::VKEY_RETURN; 540 text = code = app::VKEY_RETURN;
541 } else if (L"rightArrow" == code_str) { 541 } else if (L"rightArrow" == code_str) {
542 code = base::VKEY_RIGHT; 542 code = app::VKEY_RIGHT;
543 } else if (L"downArrow" == code_str) { 543 } else if (L"downArrow" == code_str) {
544 code = base::VKEY_DOWN; 544 code = app::VKEY_DOWN;
545 } else if (L"leftArrow" == code_str) { 545 } else if (L"leftArrow" == code_str) {
546 code = base::VKEY_LEFT; 546 code = app::VKEY_LEFT;
547 } else if (L"upArrow" == code_str) { 547 } else if (L"upArrow" == code_str) {
548 code = base::VKEY_UP; 548 code = app::VKEY_UP;
549 } else if (L"insert" == code_str) { 549 } else if (L"insert" == code_str) {
550 code = base::VKEY_INSERT; 550 code = app::VKEY_INSERT;
551 } else if (L"delete" == code_str) { 551 } else if (L"delete" == code_str) {
552 code = base::VKEY_BACK; 552 code = app::VKEY_BACK;
553 } else if (L"pageUp" == code_str) { 553 } else if (L"pageUp" == code_str) {
554 code = base::VKEY_PRIOR; 554 code = app::VKEY_PRIOR;
555 } else if (L"pageDown" == code_str) { 555 } else if (L"pageDown" == code_str) {
556 code = base::VKEY_NEXT; 556 code = app::VKEY_NEXT;
557 } else if (L"home" == code_str) { 557 } else if (L"home" == code_str) {
558 code = base::VKEY_HOME; 558 code = app::VKEY_HOME;
559 } else if (L"end" == code_str) { 559 } else if (L"end" == code_str) {
560 code = base::VKEY_END; 560 code = app::VKEY_END;
561 } else if (L"printScreen" == code_str) { 561 } else if (L"printScreen" == code_str) {
562 code = base::VKEY_SNAPSHOT; 562 code = app::VKEY_SNAPSHOT;
563 } else { 563 } else {
564 // Compare the input string with the function-key names defined by the 564 // Compare the input string with the function-key names defined by the
565 // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key 565 // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key
566 // name, set its key code. 566 // name, set its key code.
567 for (int i = 1; i <= 24; ++i) { 567 for (int i = 1; i <= 24; ++i) {
568 std::wstring function_key_name; 568 std::wstring function_key_name;
569 function_key_name += L"F"; 569 function_key_name += L"F";
570 function_key_name += UTF8ToWide(base::IntToString(i)); 570 function_key_name += UTF8ToWide(base::IntToString(i));
571 if (function_key_name == code_str) { 571 if (function_key_name == code_str) {
572 code = base::VKEY_F1 + (i - 1); 572 code = app::VKEY_F1 + (i - 1);
573 break; 573 break;
574 } 574 }
575 } 575 }
576 if (!code) { 576 if (!code) {
577 DCHECK(code_str.length() == 1); 577 DCHECK(code_str.length() == 1);
578 text = code = code_str[0]; 578 text = code = code_str[0];
579 needs_shift_key_modifier = NeedsShiftModifier(code); 579 needs_shift_key_modifier = NeedsShiftModifier(code);
580 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z') 580 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z')
581 code -= 'a' - 'A'; 581 code -= 'a' - 'A';
582 generate_char = true; 582 generate_char = true;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 1009
1010 void EventSendingController::fireKeyboardEventsToElement( 1010 void EventSendingController::fireKeyboardEventsToElement(
1011 const CppArgumentList& args, CppVariant* result) { 1011 const CppArgumentList& args, CppVariant* result) {
1012 result->SetNull(); 1012 result->SetNull();
1013 } 1013 }
1014 1014
1015 void EventSendingController::clearKillRing( 1015 void EventSendingController::clearKillRing(
1016 const CppArgumentList& args, CppVariant* result) { 1016 const CppArgumentList& args, CppVariant* result) {
1017 result->SetNull(); 1017 result->SetNull();
1018 } 1018 }
OLDNEW
« no previous file with comments | « webkit/support/webkit_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698