diff options
Diffstat (limited to 'chrome')
28 files changed, 89 insertions, 125 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc index e87ae0c..f6e4f13 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc @@ -121,7 +121,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, ASSERT_TRUE(*edit_view); } - void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) { + void SendKey(wchar_t key, bool control, bool shift, bool alt) { gfx::NativeWindow window = NULL; ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window)); ui_controls::SendKeyPressNotifyWhenDone(window, key, control, shift, alt, @@ -131,8 +131,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, void SendKeySequence(const wchar_t* keys) { for (; *keys; ++keys) - ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<base::KeyboardCode>(*keys), - false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(*keys, false, false, false)); } void WaitForTabOpenOrClose(int expected_tab_count) { @@ -145,7 +144,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, (tab_count < expected_tab_count ? NotificationType::TAB_PARENTED : NotificationType::TAB_CLOSED), - NotificationService::AllSources()); + NotificationService::AllSources()); while (!HasFailure() && browser()->tab_count() != expected_tab_count) ui_test_utils::RunMessageLoop(); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 91ea6b1..1fc89f4 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -17,7 +17,6 @@ #include "base/basictypes.h" #include "base/clipboard.h" #include "base/iat_patch.h" -#include "base/keyboard_codes.h" #include "base/lazy_instance.h" #include "base/ref_counted.h" #include "base/scoped_clipboard_writer.h" @@ -877,11 +876,11 @@ void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( const views::KeyEvent& e) { - base::KeyboardCode key = e.GetKeyCode(); + int c = e.GetCharacter(); // We don't process ALT + numpad digit as accelerators, they are used for // entering special characters. We do translate alt-home. - if (e.IsAltDown() && (key != base::VKEY_HOME) && - win_util::IsNumPadDigit(key, e.IsExtendedKey())) + if (e.IsAltDown() && (c != VK_HOME) && + win_util::IsNumPadDigit(c, e.IsExtendedKey())) return true; // Skip accelerators for key combinations omnibox wants to crack. This list @@ -891,29 +890,30 @@ bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( // We cannot return true for all keys because we still need to handle some // accelerators (e.g., F5 for reload the page should work even when the // Omnibox gets focused). - switch (key) { - case base::VKEY_ESCAPE: { + switch (c) { + case VK_ESCAPE: { ScopedFreeze freeze(this, GetTextObjectModel()); return model_->OnEscapeKeyPressed(); } - case base::VKEY_RETURN: + case VK_RETURN: return true; - case base::VKEY_UP: - case base::VKEY_DOWN: + case VK_UP: + case VK_DOWN: return !e.IsAltDown(); - case base::VKEY_DELETE: - case base::VKEY_INSERT: + case VK_DELETE: + case VK_INSERT: return !e.IsAltDown() && e.IsShiftDown() && !e.IsControlDown(); - case base::VKEY_X: - case base::VKEY_V: + case 'X': + case 'V': return !e.IsAltDown() && e.IsControlDown(); - case base::VKEY_BACK: - case base::VKEY_OEM_PLUS: + case VK_BACK: + case 0xbb: // We don't use VK_OEM_PLUS in case the macro isn't defined. + // (e.g., we don't have this symbol in embeded environment). return true; default: diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 627c604..b4fc56d 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -10,7 +10,6 @@ #include "app/message_box_flags.h" #include "base/file_version_info.h" #include "base/json_reader.h" -#include "base/keyboard_codes.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/stl_util-inl.h" @@ -829,14 +828,14 @@ void AutomationProvider::WindowSimulateClick(const IPC::Message& message, void AutomationProvider::WindowSimulateKeyPress(const IPC::Message& message, int handle, - int key, + wchar_t key, int flags) { if (!window_tracker_->ContainsHandle(handle)) return; gfx::NativeWindow window = window_tracker_->GetResource(handle); // The key event is sent to whatever window is active. - ui_controls::SendKeyPress(window, static_cast<base::KeyboardCode>(key), + ui_controls::SendKeyPress(window, key, ((flags & views::Event::EF_CONTROL_DOWN) == views::Event::EF_CONTROL_DOWN), ((flags & views::Event::EF_SHIFT_DOWN) == diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index be11f91..a376610 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -174,7 +174,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, int flags); void WindowSimulateKeyPress(const IPC::Message& message, int handle, - int key, + wchar_t key, int flags); void GetWindowBounds(int handle, gfx::Rect* bounds, bool* result); void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result); diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index f226289..9af097d 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -4,7 +4,6 @@ #include "chrome/browser/automation/automation_provider.h" -#include "base/keyboard_codes.h" #include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/external_tab_container.h" @@ -234,7 +233,7 @@ void AutomationProvider::WindowSimulateDrag(int handle, if (press_escape_en_route) { // Press Escape. - ui_controls::SendKeyPress(window, base::VKEY_ESCAPE, + ui_controls::SendKeyPress(window, VK_ESCAPE, ((flags & views::Event::EF_CONTROL_DOWN) == views::Event::EF_CONTROL_DOWN), ((flags & views::Event::EF_SHIFT_DOWN) == diff --git a/chrome/browser/automation/ui_controls.h b/chrome/browser/automation/ui_controls.h index 4613626..7a7a6d6 100644 --- a/chrome/browser/automation/ui_controls.h +++ b/chrome/browser/automation/ui_controls.h @@ -15,7 +15,6 @@ #include "base/gfx/native_widget_types.h" #include "base/gfx/point.h" -#include "base/keyboard_codes.h" #if defined(TOOLKIT_VIEWS) namespace views { @@ -43,17 +42,12 @@ namespace ui_controls { // these functions, so passing NULL is ok. // Send a key press with/without modifier keys. -bool SendKeyPress(gfx::NativeWindow window, - base::KeyboardCode key, - bool control, - bool shift, - bool alt); -bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, - base::KeyboardCode key, - bool control, - bool shift, - bool alt, - Task* task); +// |key| should be a VKEY code as defined in base/keyboard_codes.h +bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control, + bool shift, bool alt); +bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, + bool control, bool shift, + bool alt, Task* task); // Simulate a mouse move. (x,y) are absolute screen coordinates. bool SendMouseMove(long x, long y); diff --git a/chrome/browser/automation/ui_controls_linux.cc b/chrome/browser/automation/ui_controls_linux.cc index 544816b..738f566 100644 --- a/chrome/browser/automation/ui_controls_linux.cc +++ b/chrome/browser/automation/ui_controls_linux.cc @@ -150,7 +150,7 @@ void FakeAMouseMotionEvent(gint x, gint y) { namespace ui_controls { bool SendKeyPress(gfx::NativeWindow window, - base::KeyboardCode key, bool control, bool shift, bool alt) { + wchar_t key, bool control, bool shift, bool alt) { GdkWindow* event_window = NULL; GtkWidget* grab_widget = gtk_grab_get_current(); if (grab_widget) { @@ -197,9 +197,9 @@ bool SendKeyPress(gfx::NativeWindow window, (shift ? GDK_SHIFT_MASK : 0) | (alt ? GDK_MOD1_MASK : 0); - guint gdk_key = base::GdkKeyCodeForWindowsKeyCode(key); - rv = rv && SendKeyEvent(event_window, true, gdk_key, state); - rv = rv && SendKeyEvent(event_window, false, gdk_key, state); + key = base::GdkKeyCodeForWindowsKeyCode(key); + rv = rv && SendKeyEvent(event_window, true, key, state); + rv = rv && SendKeyEvent(event_window, false, key, state); if (alt) { guint state = (control ? GDK_CONTROL_MASK : 0) | @@ -218,10 +218,9 @@ bool SendKeyPress(gfx::NativeWindow window, return rv; } -bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, - base::KeyboardCode key, - bool control, bool shift, bool alt, - Task* task) { +bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, + bool control, bool shift, + bool alt, Task* task) { int release_count = 1; if (control) release_count++; diff --git a/chrome/browser/automation/ui_controls_win.cc b/chrome/browser/automation/ui_controls_win.cc index 29ca089..78b1acb 100644 --- a/chrome/browser/automation/ui_controls_win.cc +++ b/chrome/browser/automation/ui_controls_win.cc @@ -4,10 +4,8 @@ #include "chrome/browser/automation/ui_controls.h" -#include "base/keyboard_codes.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/win_util.h" #include "base/ref_counted.h" #include "base/task.h" #include "views/view.h" @@ -135,18 +133,18 @@ void InputDispatcher::NotifyTask() { // Populate the INPUT structure with the appropriate keyboard event // parameters required by SendInput -bool FillKeyboardInput(base::KeyboardCode key, INPUT* input, bool key_up) { +bool FillKeyboardInput(wchar_t key, INPUT* input, bool key_up) { memset(input, 0, sizeof(INPUT)); input->type = INPUT_KEYBOARD; - input->ki.wVk = win_util::KeyboardCodeToWin(key); + input->ki.wVk = static_cast<WORD>(key); input->ki.dwFlags = key_up ? KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP : - KEYEVENTF_EXTENDEDKEY; + KEYEVENTF_EXTENDEDKEY; return true; } // Send a key event (up/down) -bool SendKeyEvent(base::KeyboardCode key, bool up) { +bool SendKeyEvent(wchar_t key, bool up) { INPUT input = { 0 }; if (!FillKeyboardInput(key, &input, up)) @@ -158,8 +156,7 @@ bool SendKeyEvent(base::KeyboardCode key, bool up) { return true; } -bool SendKeyPressImpl(base::KeyboardCode key, - bool control, bool shift, bool alt, +bool SendKeyPressImpl(wchar_t key, bool control, bool shift, bool alt, Task* task) { scoped_refptr<InputDispatcher> dispatcher( task ? new InputDispatcher(task, WM_KEYUP) : NULL); @@ -168,19 +165,19 @@ bool SendKeyPressImpl(base::KeyboardCode key, int i = 0; if (control) { - if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], false)) + if (!FillKeyboardInput(VK_CONTROL, &input[i], false)) return false; i++; } if (shift) { - if (!FillKeyboardInput(base::VKEY_SHIFT, &input[i], false)) + if (!FillKeyboardInput(VK_SHIFT, &input[i], false)) return false; i++; } if (alt) { - if (!FillKeyboardInput(base::VKEY_MENU, &input[i], false)) + if (!FillKeyboardInput(VK_MENU, &input[i], false)) return false; i++; } @@ -194,19 +191,19 @@ bool SendKeyPressImpl(base::KeyboardCode key, i++; if (alt) { - if (!FillKeyboardInput(base::VKEY_MENU, &input[i], true)) + if (!FillKeyboardInput(VK_MENU, &input[i], true)) return false; i++; } if (shift) { - if (!FillKeyboardInput(base::VKEY_SHIFT, &input[i], true)) + if (!FillKeyboardInput(VK_SHIFT, &input[i], true)) return false; i++; } if (control) { - if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], true)) + if (!FillKeyboardInput(VK_CONTROL, &input[i], true)) return false; i++; } @@ -307,15 +304,14 @@ bool SendMouseEventsImpl(MouseButton type, int state, Task* task) { // public functions ----------------------------------------------------------- -bool SendKeyPress(gfx::NativeWindow window, base::KeyboardCode key, - bool control, bool shift, bool alt) { +bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control, + bool shift, bool alt) { return SendKeyPressImpl(key, control, shift, alt, NULL); } -bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, - base::KeyboardCode key, - bool control, bool shift, bool alt, - Task* task) { +bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, + bool control, bool shift, + bool alt, Task* task) { return SendKeyPressImpl(key, control, shift, alt, task); } diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc index 60ec1b9..313bc09 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -9,7 +9,6 @@ #include "app/gfx/canvas.h" #include "app/gfx/color_utils.h" #include "app/l10n_util.h" -#include "base/keyboard_codes.h" #include "base/thread.h" #include "chrome/browser/bookmarks/bookmark_folder_tree_model.h" #include "chrome/browser/bookmarks/bookmark_html_writer.h" @@ -226,7 +225,7 @@ BookmarkManagerView::BookmarkManagerView(Profile* profile) layout->AddView(split_view_); // Press Ctrl-W to close bookmark manager window. - AddAccelerator(views::Accelerator(base::VKEY_W, false, true, false)); + AddAccelerator(views::Accelerator('W', false, true, false)); BookmarkModel* bookmark_model = profile_->GetBookmarkModel(); if (!bookmark_model->IsLoaded()) diff --git a/chrome/browser/views/find_bar_host_browsertest.cc b/chrome/browser/views/find_bar_host_browsertest.cc index caed556..703a401 100644 --- a/chrome/browser/views/find_bar_host_browsertest.cc +++ b/chrome/browser/views/find_bar_host_browsertest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/keyboard_codes.h" #include "base/message_loop.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_window.h" @@ -591,7 +590,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, AcceleratorRestoring) { views::FocusManager::GetFocusManagerForNativeView(browser_view); // See where Escape is registered. - views::Accelerator escape(base::VKEY_ESCAPE, false, false, false); + views::Accelerator escape(VK_ESCAPE, false, false, false); views::AcceleratorTarget* old_target = focus_manager->GetCurrentTargetForAccelerator(escape); EXPECT_TRUE(old_target != NULL); diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/views/find_bar_host_interactive_uitest.cc index fe2cecd..75f10d5 100644 --- a/chrome/browser/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/views/find_bar_host_interactive_uitest.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. -#include "base/keyboard_codes.h" #include "chrome/browser/view_ids.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/window_proxy.h" @@ -91,6 +90,6 @@ TEST_F(FindInPageTest, CrashEscHandlers) { EXPECT_EQ(VIEW_ID_LOCATION_BAR, focused_view_id); // This used to crash until bug 1303709 was fixed. - EXPECT_TRUE(window->SimulateOSKeyPress(base::VKEY_ESCAPE, 0)); + EXPECT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); ::Sleep(kActionDelayMs); } diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 50fd3bd..d4a0e8f 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -10,7 +10,6 @@ #include "app/os_exchange_data.h" #include "app/resource_bundle.h" #include "base/command_line.h" -#include "base/keyboard_codes.h" #include "base/time.h" #include "build/build_config.h" #include "chrome/app/chrome_dll_resource.h" @@ -586,13 +585,13 @@ bool BrowserView::GetAccelerator(int cmd_id, views::Accelerator* accelerator) { // anywhere so we need to check for them explicitly here. switch (cmd_id) { case IDC_CUT: - *accelerator = views::Accelerator(base::VKEY_X, false, true, false); + *accelerator = views::Accelerator(L'X', false, true, false); return true; case IDC_COPY: - *accelerator = views::Accelerator(base::VKEY_C, false, true, false); + *accelerator = views::Accelerator(L'C', false, true, false); return true; case IDC_PASTE: - *accelerator = views::Accelerator(base::VKEY_V, false, true, false); + *accelerator = views::Accelerator(L'V', false, true, false); return true; } // Else, we retrieve the accelerator information from the accelerator table. @@ -1994,9 +1993,8 @@ void BrowserView::LoadAccelerators() { bool alt_down = (accelerators[i].fVirt & FALT) == FALT; bool ctrl_down = (accelerators[i].fVirt & FCONTROL) == FCONTROL; bool shift_down = (accelerators[i].fVirt & FSHIFT) == FSHIFT; - views::Accelerator accelerator( - static_cast<base::KeyboardCode>(accelerators[i].key), - shift_down, ctrl_down, alt_down); + views::Accelerator accelerator(accelerators[i].key, shift_down, ctrl_down, + alt_down); accelerator_table_[accelerator] = accelerators[i].cmd; // Also register with the focus manager. diff --git a/chrome/browser/views/fullscreen_exit_bubble.cc b/chrome/browser/views/fullscreen_exit_bubble.cc index b7e5705..907a791 100644 --- a/chrome/browser/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/views/fullscreen_exit_bubble.cc @@ -8,7 +8,6 @@ #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/resource_bundle.h" -#include "base/keyboard_codes.h" #include "chrome/app/chrome_dll_resource.h" #include "grit/generated_resources.h" #include "views/widget/root_view.h" @@ -134,7 +133,7 @@ FullscreenExitBubble::FullscreenExitBubble( size_animation_->Reset(1); // Create the contents view. - views::Accelerator accelerator(base::VKEY_UNKNOWN, false, false, false); + views::Accelerator accelerator(0, false, false, false); bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); DCHECK(got_accelerator); view_ = new FullscreenExitView(this, popup_, accelerator.GetShortcutText()); diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 91a41a4..40244ef 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -7,7 +7,6 @@ #include "app/gfx/canvas.h" #include "app/gfx/color_utils.h" #include "app/gfx/path.h" -#include "base/keyboard_codes.h" #include "chrome/browser/window_sizer.h" #include "chrome/common/notification_service.h" #include "third_party/skia/include/core/SkPaint.h" @@ -279,7 +278,7 @@ void InfoBubble::Init(views::Window* parent, #if defined(OS_WIN) // Register the Escape accelerator for closing. GetFocusManager()->RegisterAccelerator( - views::Accelerator(base::VKEY_ESCAPE, false, false, false), this); + views::Accelerator(VK_ESCAPE, false, false, false), this); #endif // Done creating the bubble. diff --git a/chrome/browser/views/jsmessage_box_dialog.cc b/chrome/browser/views/jsmessage_box_dialog.cc index 3fb70e0..df60f0f9 100644 --- a/chrome/browser/views/jsmessage_box_dialog.cc +++ b/chrome/browser/views/jsmessage_box_dialog.cc @@ -6,7 +6,6 @@ #include "app/l10n_util.h" #include "app/message_box_flags.h" -#include "base/keyboard_codes.h" #include "chrome/browser/app_modal_dialog.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" @@ -26,7 +25,7 @@ JavascriptMessageBoxDialog::JavascriptMessageBoxDialog( DCHECK(message_box_view_); message_box_view_->AddAccelerator( - views::Accelerator(base::VKEY_C, false, true, false)); + views::Accelerator('C', false, true, false)); if (display_suppress_checkbox) { message_box_view_->SetCheckBoxLabel( l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); diff --git a/chrome/browser/views/star_toggle.cc b/chrome/browser/views/star_toggle.cc index ebb67ac..0e03f91 100644 --- a/chrome/browser/views/star_toggle.cc +++ b/chrome/browser/views/star_toggle.cc @@ -6,7 +6,6 @@ #include "app/gfx/canvas.h" #include "app/resource_bundle.h" -#include "base/keyboard_codes.h" #include "chrome/app/chrome_dll_resource.h" #include "grit/theme_resources.h" @@ -64,8 +63,7 @@ void StarToggle::OnMouseReleased(const views::MouseEvent& e, } bool StarToggle::OnKeyPressed(const views::KeyEvent& e) { - if ((e.GetKeyCode() == base::VKEY_SPACE) || - (e.GetKeyCode() == base::VKEY_RETURN)) { + if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) { SwitchState(); return true; } diff --git a/chrome/browser/views/tab_contents/render_view_context_menu_win.cc b/chrome/browser/views/tab_contents/render_view_context_menu_win.cc index a46174a..63bbca6 100644 --- a/chrome/browser/views/tab_contents/render_view_context_menu_win.cc +++ b/chrome/browser/views/tab_contents/render_view_context_menu_win.cc @@ -6,7 +6,6 @@ #include "app/l10n_util.h" #include "base/compiler_specific.h" -#include "base/keyboard_codes.h" #include "chrome/browser/profile.h" #include "grit/generated_resources.h" @@ -47,28 +46,27 @@ bool RenderViewContextMenuWin::GetAcceleratorForCommandId( // that Ctrl+C, Ctrl+V, Ctrl+X, Ctrl-A, etc do what they normally do. switch (command_id) { case IDS_CONTENT_CONTEXT_UNDO: - *accel = views::Accelerator(base::VKEY_Z, false, true, false); + *accel = views::Accelerator(L'Z', false, true, false); return true; case IDS_CONTENT_CONTEXT_REDO: - // TODO(jcampan): should it be Ctrl-Y? - *accel = views::Accelerator(base::VKEY_Z, true, true, false); + *accel = views::Accelerator(L'Z', true, true, false); return true; case IDS_CONTENT_CONTEXT_CUT: - *accel = views::Accelerator(base::VKEY_X, false, true, false); + *accel = views::Accelerator(L'X', false, true, false); return true; case IDS_CONTENT_CONTEXT_COPY: - *accel = views::Accelerator(base::VKEY_C, false, true, false); + *accel = views::Accelerator(L'C', false, true, false); return true; case IDS_CONTENT_CONTEXT_PASTE: - *accel = views::Accelerator(base::VKEY_V, false, true, false); + *accel = views::Accelerator(L'V', false, true, false); return true; case IDS_CONTENT_CONTEXT_SELECTALL: - *accel = views::Accelerator(base::VKEY_A, false, true, false); + *accel = views::Accelerator(L'A', false, true, false); return true; default: diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/views/tab_contents/tab_contents_view_win.cc index 7352951..22a1552 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_win.cc @@ -9,9 +9,7 @@ #include "app/gfx/canvas_paint.h" #include "app/os_exchange_data.h" #include "app/os_exchange_data_provider_win.h" -#include "base/keyboard_codes.h" #include "base/time.h" -#include "base/win_util.h" #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. #include "chrome/browser/browser_process.h" @@ -405,8 +403,7 @@ void TabContentsViewWin::HandleKeyboardEvent( // We may not have a focus_manager at this point (if the tab has been // switched by the time this message returned). if (focus_manager) { - views::Accelerator accelerator( - win_util::WinToKeyboardCode(event.windowsKeyCode), + views::Accelerator accelerator(event.windowsKeyCode, (event.modifiers & WebInputEvent::ShiftKey) == WebInputEvent::ShiftKey, (event.modifiers & WebInputEvent::ControlKey) == diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc index b41fbe1..5256b03 100644 --- a/chrome/browser/views/task_manager_view.cc +++ b/chrome/browser/views/task_manager_view.cc @@ -334,8 +334,7 @@ void TaskManagerView::Init() { SetContextMenuController(this); kill_button_ = new views::NativeButton( this, l10n_util::GetString(IDS_TASK_MANAGER_KILL)); - kill_button_->AddAccelerator(views::Accelerator(base::VKEY_E, - false, false, false)); + kill_button_->AddAccelerator(views::Accelerator('E', false, false, false)); kill_button_->SetAccessibleKeyboardShortcut(L"E"); about_memory_link_ = new views::Link( l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); @@ -536,7 +535,7 @@ void TaskManagerView::OnDoubleClick() { } void TaskManagerView::OnKeyDown(unsigned short virtual_keycode) { - if (virtual_keycode == base::VKEY_RETURN) + if (virtual_keycode == VK_RETURN) ActivateFocusedTab(); } diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 81d006f..d917804 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -416,13 +416,13 @@ bool ToolbarView::GetAcceleratorForCommandId(int command_id, // TODO(cpu) Bug 1109102. Query WebKit land for the actual bindings. switch (command_id) { case IDC_CUT: - *accelerator = views::Accelerator(base::VKEY_X, false, true, false); + *accelerator = views::Accelerator(L'X', false, true, false); return true; case IDC_COPY: - *accelerator = views::Accelerator(base::VKEY_C, false, true, false); + *accelerator = views::Accelerator(L'C', false, true, false); return true; case IDC_PASTE: - *accelerator = views::Accelerator(base::VKEY_V, false, true, false); + *accelerator = views::Accelerator(L'V', false, true, false); return true; } // Else, we retrieve the accelerator information from the frame. @@ -639,7 +639,7 @@ bool ToolbarView::OnKeyPressed(const views::KeyEvent& e) { int focused_view = GetChildIndex(acc_focused_view_); int next_view = focused_view; - switch (e.GetKeyCode()) { + switch (e.GetCharacter()) { case base::VKEY_LEFT: next_view = GetNextAccessibleViewIndex(focused_view, true); break; diff --git a/chrome/browser/views/url_picker.cc b/chrome/browser/views/url_picker.cc index 5232676..e9837ff 100644 --- a/chrome/browser/views/url_picker.cc +++ b/chrome/browser/views/url_picker.cc @@ -8,7 +8,6 @@ #include "app/resource_bundle.h" #include "app/table_model.h" #include "app/table_model_observer.h" -#include "base/keyboard_codes.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "chrome/browser/net/url_fixer_upper.h" @@ -131,7 +130,7 @@ UrlPicker::UrlPicker(UrlPickerDelegate* delegate, layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - AddAccelerator(views::Accelerator(base::VKEY_RETURN, false, false, false)); + AddAccelerator(views::Accelerator(VK_RETURN, false, false, false)); } UrlPicker::~UrlPicker() { diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index fd22151..252689c 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -607,8 +607,7 @@ bool AutomatedUITest::ForceCrash() { return true; } -bool AutomatedUITest::SimulateKeyPressInActiveWindow(base::KeyboardCode key, - int flags) { +bool AutomatedUITest::SimulateKeyPressInActiveWindow(wchar_t key, int flags) { scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); if (window.get() == NULL) { AddErrorAttribute("active_window_not_found"); diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.h b/chrome/test/automated_ui_tests/automated_ui_tests.h index 286234a..d370b70 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.h +++ b/chrome/test/automated_ui_tests/automated_ui_tests.h @@ -102,7 +102,6 @@ #include <string> -#include "base/keyboard_codes.h" #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" #include "chrome/test/ui/ui_test.h" @@ -294,7 +293,7 @@ class AutomatedUITest : public AutomatedUITestBase { // Calls SimulateOSKeyPress on the active window. Simulates a key press at // the OS level. |key| is the key pressed and |flags| specifies which // modifiers keys are also pressed (as defined in chrome/views/event.h). - bool SimulateKeyPressInActiveWindow(base::KeyboardCode key, int flags); + bool SimulateKeyPressInActiveWindow(wchar_t key, int flags); // Opens init file, reads it into the reader, and closes the file. // Returns false if there are any errors. diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 89f90ff..e7016cf 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -415,10 +415,10 @@ IPC_BEGIN_MESSAGES(Automation) // This message requests that a key press be performed. // Request: // int - the handle of the window that's the context for this click - // int - the base::KeyboardCode of the key that was pressed. + // wchar_t - char of the key that was pressed. // int - the flags which identify the modifiers (shift, ctrl, alt) // associated for, as defined in chrome/views/event.h - IPC_MESSAGE_ROUTED3(AutomationMsg_WindowKeyPress, int, int, int) + IPC_MESSAGE_ROUTED3(AutomationMsg_WindowKeyPress, int, wchar_t, int) // This message notifies the AutomationProvider to create a tab which is // hosted by an external process. diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc index 5b08842..5766259 100644 --- a/chrome/test/automation/window_proxy.cc +++ b/chrome/test/automation/window_proxy.cc @@ -34,7 +34,7 @@ bool WindowProxy::GetWindowTitle(string16* text) { return sender_->Send(new AutomationMsg_WindowTitle(0, handle_, text)); } -bool WindowProxy::SimulateOSKeyPress(base::KeyboardCode key, int flags) { +bool WindowProxy::SimulateOSKeyPress(wchar_t key, int flags) { if (!is_valid()) return false; return sender_->Send( diff --git a/chrome/test/automation/window_proxy.h b/chrome/test/automation/window_proxy.h index 33a27c0..539ac20 100644 --- a/chrome/test/automation/window_proxy.h +++ b/chrome/test/automation/window_proxy.h @@ -13,7 +13,6 @@ #include <string> -#include "base/keyboard_codes.h" #include "base/string16.h" #include "base/thread.h" #include "chrome/test/automation/automation_handle_tracker.h" @@ -47,11 +46,11 @@ class WindowProxy : public AutomationResourceProxy { // Get the title of the top level window. bool GetWindowTitle(string16* text); - // Simulates a key press at the OS level. |key| is the virtual key code of the - // key pressed and |flags| specifies which modifiers keys are also pressed (as - // defined in chrome/views/event.h). Note that this actually sends the event - // to the window that has focus. - bool SimulateOSKeyPress(base::KeyboardCode key, int flags); + // Simulates a key press at the OS level. |key| is the key pressed and + // |flags| specifies which modifiers keys are also pressed (as defined in + // chrome/views/event.h). Note that this actually sends the event to the + // window that has focus. + bool SimulateOSKeyPress(wchar_t key, int flags); // Shows/hides the window and as a result makes it active/inactive. // Returns true if the call was successful. diff --git a/chrome/test/interactive_ui/npapi_interactive_test.cc b/chrome/test/interactive_ui/npapi_interactive_test.cc index 9610f39..49271a6 100644 --- a/chrome/test/interactive_ui/npapi_interactive_test.cc +++ b/chrome/test/interactive_ui/npapi_interactive_test.cc @@ -32,7 +32,6 @@ // #include "base/file_util.h" -#include "base/keyboard_codes.h" #include "chrome/browser/net/url_request_mock_http_job.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/automation/tab_proxy.h" @@ -93,7 +92,7 @@ TEST_F(NPAPIVisiblePluginTester, GetURLRequest404Response) { automation()->WaitForAppModalDialog(action_max_timeout_ms()); scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); ASSERT_TRUE(window.get()); - ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_ESCAPE, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie, kTestCompleteSuccess, kShortWaitTimeout); diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index ab43ca9..32139fa 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -16,7 +16,6 @@ #include <ostream> #include "base/file_util.h" -#include "base/keyboard_codes.h" #include "chrome/browser/net/url_request_mock_http_job.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/automation/tab_proxy.h" @@ -139,7 +138,7 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { automation()->WaitForAppModalDialog(5000); scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); ASSERT_TRUE(window.get()); - ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_ESCAPE, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); WaitForFinish("self_delete_plugin_invoke_alert", "1", url, kTestCompleteCookie, kTestCompleteSuccess, |