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

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

Issue 3165064: Move the keyboard files from base/ to app/. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: latest merge Created 10 years, 4 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
« no previous file with comments | « views/window/dialog_client_view.cc ('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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // modifiers. These key events correspond to some special movement and 208 // modifiers. These key events correspond to some special movement and
209 // selection editor commands, and was supposed to be handled in 209 // selection editor commands, and was supposed to be handled in
210 // third_party/WebKit/WebKit/chromium/src/EditorClientImpl.cpp. But these keys 210 // third_party/WebKit/WebKit/chromium/src/EditorClientImpl.cpp. But these keys
211 // will be marked as system key, which prevents them from being handled. 211 // will be marked as system key, which prevents them from being handled.
212 // Thus they must be handled specially. 212 // Thus they must be handled specially.
213 if ((event.modifiers & ~WebKeyboardEvent::ShiftKey) != 213 if ((event.modifiers & ~WebKeyboardEvent::ShiftKey) !=
214 WebKeyboardEvent::MetaKey) 214 WebKeyboardEvent::MetaKey)
215 return false; 215 return false;
216 216
217 switch (event.windowsKeyCode) { 217 switch (event.windowsKeyCode) {
218 case base::VKEY_LEFT: 218 case app::VKEY_LEFT:
219 *name = "MoveToBeginningOfLine"; 219 *name = "MoveToBeginningOfLine";
220 break; 220 break;
221 case base::VKEY_RIGHT: 221 case app::VKEY_RIGHT:
222 *name = "MoveToEndOfLine"; 222 *name = "MoveToEndOfLine";
223 break; 223 break;
224 case base::VKEY_UP: 224 case app::VKEY_UP:
225 *name = "MoveToBeginningOfDocument"; 225 *name = "MoveToBeginningOfDocument";
226 break; 226 break;
227 case base::VKEY_DOWN: 227 case app::VKEY_DOWN:
228 *name = "MoveToEndOfDocument"; 228 *name = "MoveToEndOfDocument";
229 break; 229 break;
230 default: 230 default:
231 return false; 231 return false;
232 } 232 }
233 233
234 if (event.modifiers & WebKeyboardEvent::ShiftKey) 234 if (event.modifiers & WebKeyboardEvent::ShiftKey)
235 name->append("AndModifySelection"); 235 name->append("AndModifySelection");
236 236
237 return true; 237 return true;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // TODO(mpcomplete): Should we also generate a KEY_UP? 548 // TODO(mpcomplete): Should we also generate a KEY_UP?
549 std::wstring code_str = UTF8ToWide(args[0].ToString()); 549 std::wstring code_str = UTF8ToWide(args[0].ToString());
550 550
551 // Convert \n -> VK_RETURN. Some layout tests use \n to mean "Enter", when 551 // Convert \n -> VK_RETURN. Some layout tests use \n to mean "Enter", when
552 // Windows uses \r for "Enter". 552 // Windows uses \r for "Enter".
553 int code = 0; 553 int code = 0;
554 int text = 0; 554 int text = 0;
555 bool needs_shift_key_modifier = false; 555 bool needs_shift_key_modifier = false;
556 if (L"\n" == code_str) { 556 if (L"\n" == code_str) {
557 generate_char = true; 557 generate_char = true;
558 text = code = base::VKEY_RETURN; 558 text = code = app::VKEY_RETURN;
559 } else if (L"rightArrow" == code_str) { 559 } else if (L"rightArrow" == code_str) {
560 code = base::VKEY_RIGHT; 560 code = app::VKEY_RIGHT;
561 } else if (L"downArrow" == code_str) { 561 } else if (L"downArrow" == code_str) {
562 code = base::VKEY_DOWN; 562 code = app::VKEY_DOWN;
563 } else if (L"leftArrow" == code_str) { 563 } else if (L"leftArrow" == code_str) {
564 code = base::VKEY_LEFT; 564 code = app::VKEY_LEFT;
565 } else if (L"upArrow" == code_str) { 565 } else if (L"upArrow" == code_str) {
566 code = base::VKEY_UP; 566 code = app::VKEY_UP;
567 } else if (L"insert" == code_str) { 567 } else if (L"insert" == code_str) {
568 code = base::VKEY_INSERT; 568 code = app::VKEY_INSERT;
569 } else if (L"delete" == code_str) { 569 } else if (L"delete" == code_str) {
570 code = base::VKEY_BACK; 570 code = app::VKEY_BACK;
571 } else if (L"pageUp" == code_str) { 571 } else if (L"pageUp" == code_str) {
572 code = base::VKEY_PRIOR; 572 code = app::VKEY_PRIOR;
573 } else if (L"pageDown" == code_str) { 573 } else if (L"pageDown" == code_str) {
574 code = base::VKEY_NEXT; 574 code = app::VKEY_NEXT;
575 } else if (L"home" == code_str) { 575 } else if (L"home" == code_str) {
576 code = base::VKEY_HOME; 576 code = app::VKEY_HOME;
577 } else if (L"end" == code_str) { 577 } else if (L"end" == code_str) {
578 code = base::VKEY_END; 578 code = app::VKEY_END;
579 } else if (L"printScreen" == code_str) { 579 } else if (L"printScreen" == code_str) {
580 code = base::VKEY_SNAPSHOT; 580 code = app::VKEY_SNAPSHOT;
581 } else { 581 } else {
582 // Compare the input string with the function-key names defined by the 582 // Compare the input string with the function-key names defined by the
583 // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key 583 // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key
584 // name, set its key code. 584 // name, set its key code.
585 for (int i = 1; i <= 24; ++i) { 585 for (int i = 1; i <= 24; ++i) {
586 std::wstring function_key_name; 586 std::wstring function_key_name;
587 function_key_name += L"F"; 587 function_key_name += L"F";
588 function_key_name += UTF8ToWide(base::IntToString(i)); 588 function_key_name += UTF8ToWide(base::IntToString(i));
589 if (function_key_name == code_str) { 589 if (function_key_name == code_str) {
590 code = base::VKEY_F1 + (i - 1); 590 code = app::VKEY_F1 + (i - 1);
591 break; 591 break;
592 } 592 }
593 } 593 }
594 if (!code) { 594 if (!code) {
595 DCHECK(code_str.length() == 1); 595 DCHECK(code_str.length() == 1);
596 text = code = code_str[0]; 596 text = code = code_str[0];
597 needs_shift_key_modifier = NeedsShiftModifier(code); 597 needs_shift_key_modifier = NeedsShiftModifier(code);
598 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z') 598 if ((code & 0xFF) >= 'a' && (code & 0xFF) <= 'z')
599 code -= 'a' - 'A'; 599 code -= 'a' - 'A';
600 generate_char = true; 600 generate_char = true;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 986
987 void EventSendingController::fireKeyboardEventsToElement( 987 void EventSendingController::fireKeyboardEventsToElement(
988 const CppArgumentList& args, CppVariant* result) { 988 const CppArgumentList& args, CppVariant* result) {
989 result->SetNull(); 989 result->SetNull();
990 } 990 }
991 991
992 void EventSendingController::clearKillRing( 992 void EventSendingController::clearKillRing(
993 const CppArgumentList& args, CppVariant* result) { 993 const CppArgumentList& args, CppVariant* result) {
994 result->SetNull(); 994 result->SetNull();
995 } 995 }
OLDNEW
« no previous file with comments | « views/window/dialog_client_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698