diff options
author | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 00:38:27 +0000 |
---|---|---|
committer | bryeung@chromium.org <bryeung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 00:38:27 +0000 |
commit | 7f05552488f8f9ea5000512fd1972894aee7ee82 (patch) | |
tree | 0e2ed5a562335907e44307a1d99e9c6ab8d8a3ec /views/controls | |
parent | 9d7e8fd4a448491817b816585d6f375d71c0a97a (diff) | |
download | chromium_src-7f05552488f8f9ea5000512fd1972894aee7ee82.zip chromium_src-7f05552488f8f9ea5000512fd1972894aee7ee82.tar.gz chromium_src-7f05552488f8f9ea5000512fd1972894aee7ee82.tar.bz2 |
Re-lands 58186:
Original message:
"""
Move the keyboard files from base/ to app/.
Also moves the associated classes/enums from base:: to app::.
TEST=try bots compile
BUG=NONE
Review URL: http://codereview.chromium.org/3165064
"""
TBR=phajdan.jr@chromium.org
Review URL: http://codereview.chromium.org/3354005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
27 files changed, 111 insertions, 109 deletions
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index 04ff856..bc949c1 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -4,8 +4,8 @@ #include "views/controls/button/custom_button.h" +#include "app/keyboard_codes.h" #include "app/throb_animation.h" -#include "base/keyboard_codes.h" #include "views/screen.h" namespace views { @@ -192,9 +192,9 @@ bool CustomButton::OnKeyPressed(const KeyEvent& e) { // Space sets button state to pushed. Enter clicks the button. This matches // the Windows native behavior of buttons, where Space clicks the button on // KeyRelease and Enter clicks the button on KeyPressed. - if (e.GetKeyCode() == base::VKEY_SPACE) { + if (e.GetKeyCode() == app::VKEY_SPACE) { SetState(BS_PUSHED); - } else if (e.GetKeyCode() == base::VKEY_RETURN) { + } else if (e.GetKeyCode() == app::VKEY_RETURN) { SetState(BS_NORMAL); NotifyClick(e); } else { @@ -204,7 +204,7 @@ bool CustomButton::OnKeyPressed(const KeyEvent& e) { } bool CustomButton::OnKeyReleased(const KeyEvent& e) { - if ((state_ == BS_DISABLED) || (e.GetKeyCode() != base::VKEY_SPACE)) + if ((state_ == BS_DISABLED) || (e.GetKeyCode() != app::VKEY_SPACE)) return false; SetState(BS_NORMAL); diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index f09b2d4..4973ea2 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -219,10 +219,10 @@ void MenuButton::OnMouseReleased(const MouseEvent& e, } bool MenuButton::OnKeyPressed(const KeyEvent& e) { - if (e.GetKeyCode() == base::VKEY_SPACE || - e.GetKeyCode() == base::VKEY_RETURN || - e.GetKeyCode() == base::VKEY_UP || - e.GetKeyCode() == base::VKEY_DOWN) { + if (e.GetKeyCode() == app::VKEY_SPACE || + e.GetKeyCode() == app::VKEY_RETURN || + e.GetKeyCode() == app::VKEY_UP || + e.GetKeyCode() == app::VKEY_DOWN) { bool result = Activate(); if (GetFocusManager()->GetFocusedView() == NULL) RequestFocus(); diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc index 4c66b9f..89dae9c 100644 --- a/views/controls/button/native_button.cc +++ b/views/controls/button/native_button.cc @@ -4,8 +4,8 @@ #include "views/controls/button/native_button.h" +#include "app/keyboard_codes.h" #include "base/i18n/rtl.h" -#include "base/keyboard_codes.h" #include "views/controls/native/native_view_host.h" #if defined(OS_WIN) @@ -90,9 +90,9 @@ void NativeButton::SetIsDefault(bool is_default) { if (is_default == is_default_) return; if (is_default) - AddAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); + AddAccelerator(Accelerator(app::VKEY_RETURN, false, false, false)); else - RemoveAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); + RemoveAccelerator(Accelerator(app::VKEY_RETURN, false, false, false)); SetAppearsAsDefault(is_default); } diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc index 0c24a0d..3eed917 100644 --- a/views/controls/combobox/combobox.cc +++ b/views/controls/combobox/combobox.cc @@ -5,7 +5,7 @@ #include "views/controls/combobox/combobox.h" #include "app/combobox_model.h" -#include "base/keyboard_codes.h" +#include "app/keyboard_codes.h" #include "base/logging.h" #include "base/utf_string_conversions.h" #include "views/controls/combobox/native_combobox_wrapper.h" @@ -75,7 +75,7 @@ void Combobox::SetEnabled(bool flag) { // VKEY_ESCAPE should be handled by this view when the drop down list is active. // In other words, the list should be closed instead of the dialog. bool Combobox::SkipDefaultKeyEventProcessing(const KeyEvent& e) { - if (e.GetKeyCode() != base::VKEY_ESCAPE || + if (e.GetKeyCode() != app::VKEY_ESCAPE || e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) { return false; } diff --git a/views/controls/link.cc b/views/controls/link.cc index 97dc01f..6cf81d3 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -8,7 +8,7 @@ #include <gdk/gdk.h> #endif -#include "base/keyboard_codes.h" +#include "app/keyboard_codes.h" #include "base/logging.h" #include "gfx/color_utils.h" #include "gfx/font.h" @@ -122,8 +122,8 @@ void Link::OnMouseReleased(const MouseEvent& e, bool canceled) { } bool Link::OnKeyPressed(const KeyEvent& e) { - bool activate = ((e.GetKeyCode() == base::VKEY_SPACE) || - (e.GetKeyCode() == base::VKEY_RETURN)); + bool activate = ((e.GetKeyCode() == app::VKEY_SPACE) || + (e.GetKeyCode() == app::VKEY_RETURN)); if (!activate) return false; @@ -140,8 +140,8 @@ bool Link::OnKeyPressed(const KeyEvent& e) { bool Link::SkipDefaultKeyEventProcessing(const KeyEvent& e) { // Make sure we don't process space or enter as accelerators. - return (e.GetKeyCode() == base::VKEY_SPACE) || - (e.GetKeyCode() == base::VKEY_RETURN); + return (e.GetKeyCode() == app::VKEY_SPACE) || + (e.GetKeyCode() == app::VKEY_RETURN); } bool Link::GetAccessibleRole(AccessibilityTypes::Role* role) { diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index d5abe50..276226c 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -4,10 +4,10 @@ #include "views/controls/menu/menu_controller.h" +#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/os_exchange_data.h" #include "base/i18n/rtl.h" -#include "base/keyboard_codes.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "gfx/canvas_skia.h" @@ -22,7 +22,7 @@ #include "views/widget/widget.h" #if defined(OS_LINUX) -#include "base/keyboard_code_conversion_gtk.h" +#include "app/keyboard_code_conversion_gtk.h" #endif using base::Time; @@ -813,8 +813,8 @@ bool MenuController::Dispatch(GdkEvent* event) { switch (event->type) { case GDK_KEY_PRESS: { - base::KeyboardCode win_keycode = - base::WindowsKeyCodeForGdkKeyCode(event->key.keyval); + app::KeyboardCode win_keycode = + app::WindowsKeyCodeForGdkKeyCode(event->key.keyval); if (!OnKeyDown(win_keycode)) return false; @@ -853,35 +853,35 @@ bool MenuController::OnKeyDown(int key_code DCHECK(blocking_run_); switch (key_code) { - case base::VKEY_UP: + case app::VKEY_UP: IncrementSelection(-1); break; - case base::VKEY_DOWN: + case app::VKEY_DOWN: IncrementSelection(1); break; // Handling of VK_RIGHT and VK_LEFT is different depending on the UI // layout. - case base::VKEY_RIGHT: + case app::VKEY_RIGHT: if (base::i18n::IsRTL()) CloseSubmenu(); else OpenSubmenuChangeSelectionIfCan(); break; - case base::VKEY_LEFT: + case app::VKEY_LEFT: if (base::i18n::IsRTL()) OpenSubmenuChangeSelectionIfCan(); else CloseSubmenu(); break; - case base::VKEY_SPACE: + case app::VKEY_SPACE: SendAcceleratorToHotTrackedView(); break; - case base::VKEY_RETURN: + case app::VKEY_RETURN: if (pending_state_.item) { if (pending_state_.item->HasSubmenu()) { OpenSubmenuChangeSelectionIfCan(); @@ -893,7 +893,7 @@ bool MenuController::OnKeyDown(int key_code } break; - case base::VKEY_ESCAPE: + case app::VKEY_ESCAPE: if (!state_.item->GetParentMenuItem() || (!state_.item->GetParentMenuItem()->GetParentMenuItem() && (!state_.item->HasSubmenu() || @@ -956,7 +956,7 @@ bool MenuController::SendAcceleratorToHotTrackedView() { if (!hot_view) return false; - Accelerator accelerator(base::VKEY_RETURN, false, false, false); + Accelerator accelerator(app::VKEY_RETURN, false, false, false); hot_view->AcceleratorPressed(accelerator); hot_view->SetHotTracked(true); return true; diff --git a/views/controls/menu/menu_win.cc b/views/controls/menu/menu_win.cc index 90637a0..0c75743 100644 --- a/views/controls/menu/menu_win.cc +++ b/views/controls/menu/menu_win.cc @@ -6,9 +6,9 @@ #include <string> +#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" -#include "base/keyboard_codes.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_util.h" @@ -443,7 +443,7 @@ void MenuWin::AddMenuItemInternal(int index, delegate()->GetLabel(item_id) : label); // Find out if there is a shortcut we need to append to the label. - views::Accelerator accelerator(base::VKEY_UNKNOWN, false, false, false); + views::Accelerator accelerator(app::VKEY_UNKNOWN, false, false, false); if (delegate() && delegate()->GetAcceleratorInfo(item_id, &accelerator)) { actual_label += L'\t'; actual_label += accelerator.GetShortcutText(); diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index 2ddf336..7954d20 100644 --- a/views/controls/menu/native_menu_gtk.cc +++ b/views/controls/menu/native_menu_gtk.cc @@ -8,11 +8,11 @@ #include <map> #include <string> +#include "app/keyboard_code_conversion_gtk.h" +#include "app/keyboard_codes.h" #include "app/menus/menu_model.h" #include "base/gtk_util.h" #include "base/i18n/rtl.h" -#include "base/keyboard_code_conversion_gtk.h" -#include "base/keyboard_codes.h" #include "base/message_loop.h" #include "base/time.h" #include "base/utf_string_conversions.h" @@ -329,7 +329,7 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index, submenu->GetNativeMenu()); } - views::Accelerator accelerator(base::VKEY_UNKNOWN, false, false, false); + views::Accelerator accelerator(app::VKEY_UNKNOWN, false, false, false); if (accel_group && model_->GetAcceleratorAt(index, &accelerator)) { int gdk_modifiers = 0; if (accelerator.IsShiftDown()) @@ -339,7 +339,7 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index, if (accelerator.IsAltDown()) gdk_modifiers |= GDK_MOD1_MASK; gtk_widget_add_accelerator(menu_item, "activate", accel_group, - base::GdkKeyCodeForWindowsKeyCode(accelerator.GetKeyCode(), false), + app::GdkKeyCodeForWindowsKeyCode(accelerator.GetKeyCode(), false), static_cast<GdkModifierType>(gdk_modifiers), GTK_ACCEL_VISIBLE); } diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc index f65cfcd..665b15e 100644 --- a/views/controls/menu/native_menu_win.cc +++ b/views/controls/menu/native_menu_win.cc @@ -4,9 +4,9 @@ #include "views/controls/menu/native_menu_win.h" +#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" -#include "base/keyboard_codes.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "gfx/canvas_skia.h" @@ -554,7 +554,7 @@ void NativeMenuWin::UpdateMenuItemInfoForString( menus::MenuModel::ItemType type = model_->GetTypeAt(model_index); if (type != menus::MenuModel::TYPE_SUBMENU) { // Add accelerator details to the label if provided. - views::Accelerator accelerator(base::VKEY_UNKNOWN, false, false, false); + views::Accelerator accelerator(app::VKEY_UNKNOWN, false, false, false); if (model_->GetAcceleratorAt(model_index, &accelerator)) { formatted += L"\t"; formatted += accelerator.GetShortcutText(); diff --git a/views/controls/native_control.cc b/views/controls/native_control.cc index 942a093..a0ff1b0 100644 --- a/views/controls/native_control.cc +++ b/views/controls/native_control.cc @@ -10,8 +10,9 @@ #include <atlframe.h> #include <atlmisc.h> +#include "app/keyboard_code_conversion_win.h" +#include "app/keyboard_codes.h" #include "app/l10n_util_win.h" -#include "base/keyboard_codes.h" #include "base/logging.h" #include "base/win_util.h" #include "gfx/native_theme_win.h" @@ -359,7 +360,7 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, DCHECK(native_control); if (message == WM_KEYDOWN && - native_control->OnKeyDown(win_util::WinToKeyboardCode(w_param))) { + native_control->OnKeyDown(app::KeyboardCodeForWindowsKeyCode(w_param))) { return 0; } else if (message == WM_SETFOCUS) { // Let the focus manager know that the focus changed. diff --git a/views/controls/native_control.h b/views/controls/native_control.h index a01ed83..5a180d2 100644 --- a/views/controls/native_control.h +++ b/views/controls/native_control.h @@ -8,7 +8,7 @@ #include <windows.h> -#include "base/keyboard_codes.h" +#include "app/keyboard_codes.h" #include "views/view.h" namespace views { @@ -81,7 +81,7 @@ class NativeControl : public View { // Invoked when a key is pressed on the control. // Should return true if the key message was processed, false otherwise. - virtual bool OnKeyDown(base::KeyboardCode virtual_key_code) { return false; } + virtual bool OnKeyDown(app::KeyboardCode virtual_key_code) { return false; } // Returns additional extended style flags. When subclasses call // CreateWindowEx in order to create the underlying control, they must OR the diff --git a/views/controls/scrollbar/bitmap_scroll_bar.cc b/views/controls/scrollbar/bitmap_scroll_bar.cc index d5ac40c..d170b50 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -8,10 +8,10 @@ #include "views/screen.h" #endif +#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "base/callback.h" #include "base/compiler_specific.h" -#include "base/keyboard_codes.h" #include "base/message_loop.h" #include "gfx/canvas.h" #include "grit/app_strings.h" @@ -496,32 +496,32 @@ bool BitmapScrollBar::OnMouseWheel(const MouseWheelEvent& event) { bool BitmapScrollBar::OnKeyPressed(const KeyEvent& event) { ScrollAmount amount = SCROLL_NONE; switch (event.GetKeyCode()) { - case base::VKEY_UP: + case app::VKEY_UP: if (!IsHorizontal()) amount = SCROLL_PREV_LINE; break; - case base::VKEY_DOWN: + case app::VKEY_DOWN: if (!IsHorizontal()) amount = SCROLL_NEXT_LINE; break; - case base::VKEY_LEFT: + case app::VKEY_LEFT: if (IsHorizontal()) amount = SCROLL_PREV_LINE; break; - case base::VKEY_RIGHT: + case app::VKEY_RIGHT: if (IsHorizontal()) amount = SCROLL_NEXT_LINE; break; - case base::VKEY_PRIOR: + case app::VKEY_PRIOR: amount = SCROLL_PREV_PAGE; break; - case base::VKEY_NEXT: + case app::VKEY_NEXT: amount = SCROLL_NEXT_PAGE; break; - case base::VKEY_HOME: + case app::VKEY_HOME: amount = SCROLL_START; break; - case base::VKEY_END: + case app::VKEY_END: amount = SCROLL_END; break; } diff --git a/views/controls/scrollbar/native_scroll_bar_gtk.cc b/views/controls/scrollbar/native_scroll_bar_gtk.cc index c5d75c8..6f318ec 100644 --- a/views/controls/scrollbar/native_scroll_bar_gtk.cc +++ b/views/controls/scrollbar/native_scroll_bar_gtk.cc @@ -6,7 +6,7 @@ #include <gtk/gtk.h> -#include "base/keyboard_codes_posix.h" +#include "app/keyboard_codes_posix.h" #include "views/controls/scrollbar/native_scroll_bar.h" #include "views/controls/scrollbar/scroll_bar.h" @@ -45,32 +45,32 @@ bool NativeScrollBarGtk::OnKeyPressed(const KeyEvent& event) { if (!native_view()) return false; switch (event.GetKeyCode()) { - case base::VKEY_UP: + case app::VKEY_UP: if (!native_scroll_bar_->IsHorizontal()) MoveStep(false /* negative */); break; - case base::VKEY_DOWN: + case app::VKEY_DOWN: if (!native_scroll_bar_->IsHorizontal()) MoveStep(true /* positive */); break; - case base::VKEY_LEFT: + case app::VKEY_LEFT: if (native_scroll_bar_->IsHorizontal()) MoveStep(false /* negative */); break; - case base::VKEY_RIGHT: + case app::VKEY_RIGHT: if (native_scroll_bar_->IsHorizontal()) MoveStep(true /* positive */); break; - case base::VKEY_PRIOR: + case app::VKEY_PRIOR: MovePage(false /* negative */); break; - case base::VKEY_NEXT: + case app::VKEY_NEXT: MovePage(true /* positive */); break; - case base::VKEY_HOME: + case app::VKEY_HOME: MoveTo(0); break; - case base::VKEY_END: + case app::VKEY_END: MoveToBottom(); break; default: diff --git a/views/controls/scrollbar/native_scroll_bar_win.cc b/views/controls/scrollbar/native_scroll_bar_win.cc index 65350e0..55592a8a 100644 --- a/views/controls/scrollbar/native_scroll_bar_win.cc +++ b/views/controls/scrollbar/native_scroll_bar_win.cc @@ -7,7 +7,7 @@ #include <algorithm> #include <string> -#include "base/keyboard_codes.h" +#include "app/keyboard_codes.h" #include "base/message_loop.h" #include "gfx/window_impl.h" #include "views/controls/scrollbar/native_scroll_bar.h" @@ -231,31 +231,31 @@ bool NativeScrollBarWin::OnKeyPressed(const KeyEvent& event) { return false; int code = -1; switch (event.GetKeyCode()) { - case base::VKEY_UP: + case app::VKEY_UP: if (!native_scroll_bar_->IsHorizontal()) code = SB_LINEUP; break; - case base::VKEY_PRIOR: + case app::VKEY_PRIOR: code = SB_PAGEUP; break; - case base::VKEY_NEXT: + case app::VKEY_NEXT: code = SB_PAGEDOWN; break; - case base::VKEY_DOWN: + case app::VKEY_DOWN: if (!native_scroll_bar_->IsHorizontal()) code = SB_LINEDOWN; break; - case base::VKEY_HOME: + case app::VKEY_HOME: code = SB_TOP; break; - case base::VKEY_END: + case app::VKEY_END: code = SB_BOTTOM; break; - case base::VKEY_LEFT: + case app::VKEY_LEFT: if (native_scroll_bar_->IsHorizontal()) code = SB_LINELEFT; break; - case base::VKEY_RIGHT: + case app::VKEY_RIGHT: if (native_scroll_bar_->IsHorizontal()) code = SB_LINERIGHT; break; diff --git a/views/controls/tabbed_pane/tabbed_pane.cc b/views/controls/tabbed_pane/tabbed_pane.cc index 110b134..8061821 100644 --- a/views/controls/tabbed_pane/tabbed_pane.cc +++ b/views/controls/tabbed_pane/tabbed_pane.cc @@ -4,7 +4,7 @@ #include "views/controls/tabbed_pane/tabbed_pane.h" -#include "base/keyboard_codes.h" +#include "app/keyboard_codes.h" #include "base/logging.h" #include "views/controls/native/native_view_host.h" #include "views/controls/tabbed_pane/native_tabbed_pane_wrapper.h" @@ -82,7 +82,7 @@ void TabbedPane::ViewHierarchyChanged(bool is_add, View* parent, View* child) { bool TabbedPane::AcceleratorPressed(const views::Accelerator& accelerator) { // We only accept Ctrl+Tab keyboard events. DCHECK(accelerator.GetKeyCode() == - base::VKEY_TAB && accelerator.IsCtrlDown()); + app::VKEY_TAB && accelerator.IsCtrlDown()); int tab_count = GetTabCount(); if (tab_count <= 1) @@ -100,9 +100,9 @@ bool TabbedPane::AcceleratorPressed(const views::Accelerator& accelerator) { void TabbedPane::LoadAccelerators() { // Ctrl+Shift+Tab - AddAccelerator(views::Accelerator(base::VKEY_TAB, true, true, false)); + AddAccelerator(views::Accelerator(app::VKEY_TAB, true, true, false)); // Ctrl+Tab - AddAccelerator(views::Accelerator(base::VKEY_TAB, false, true, false)); + AddAccelerator(views::Accelerator(app::VKEY_TAB, false, true, false)); } void TabbedPane::Layout() { diff --git a/views/controls/table/group_table_view.cc b/views/controls/table/group_table_view.cc index 14a5eae..efef1a5 100644 --- a/views/controls/table/group_table_view.cc +++ b/views/controls/table/group_table_view.cc @@ -61,7 +61,7 @@ void GroupTableView::SyncSelection() { } } -bool GroupTableView::OnKeyDown(base::KeyboardCode virtual_keycode) { +bool GroupTableView::OnKeyDown(app::KeyboardCode virtual_keycode) { // In a list view, multiple items can be selected but only one item has the // focus. This creates a problem when the arrow keys are used for navigating // between items in the list view. An example will make this more clear: @@ -87,8 +87,8 @@ bool GroupTableView::OnKeyDown(base::KeyboardCode virtual_keycode) { // detect that one of the arrow keys is pressed. Thus, when it comes time // for the list view control to actually switch the focus, the right item // will be selected. - if ((virtual_keycode != base::VKEY_UP) && - (virtual_keycode != base::VKEY_DOWN)) { + if ((virtual_keycode != app::VKEY_UP) && + (virtual_keycode != app::VKEY_DOWN)) { return TableView::OnKeyDown(virtual_keycode); } @@ -116,10 +116,10 @@ bool GroupTableView::OnKeyDown(base::KeyboardCode virtual_keycode) { // If the user pressed the UP key, then the focus should be set to the // topmost element in the group. If the user pressed the DOWN key, the focus // should be set to the bottommost element. - if (virtual_keycode == base::VKEY_UP) { + if (virtual_keycode == app::VKEY_UP) { SetFocusOnItem(group_range.start); } else { - DCHECK_EQ(virtual_keycode, base::VKEY_DOWN); + DCHECK_EQ(virtual_keycode, app::VKEY_DOWN); SetFocusOnItem(group_range.start + group_range.length - 1); } diff --git a/views/controls/table/group_table_view.h b/views/controls/table/group_table_view.h index 0e9f1ee..d4853cb 100644 --- a/views/controls/table/group_table_view.h +++ b/views/controls/table/group_table_view.h @@ -56,7 +56,7 @@ class GroupTableView : public TableView { // keys), we must take action when an arrow key is pressed. The reason we // need to process this message has to do with the manner in which the focus // needs to be set on a group item when a group is selected. - virtual bool OnKeyDown(base::KeyboardCode virtual_keycode); + virtual bool OnKeyDown(app::KeyboardCode virtual_keycode); // Overriden to make sure rows in the same group stay grouped together. virtual int CompareRows(int model_row1, int model_row2); diff --git a/views/controls/table/native_table_win.cc b/views/controls/table/native_table_win.cc index f0b0659..82561e1 100644 --- a/views/controls/table/native_table_win.cc +++ b/views/controls/table/native_table_win.cc @@ -463,7 +463,7 @@ void NativeTableWin::OnMiddleClick() { table_->observer()->OnMiddleClick(); } -bool NativeTableWin::OnKeyDown(base::KeyboardCode virtual_keycode) { +bool NativeTableWin::OnKeyDown(app::KeyboardCode virtual_keycode) { if (!ignore_listview_change_ && table_->observer()) table_->observer()->OnKeyDown(virtual_keycode); return false; // Let the key event be processed as ususal. diff --git a/views/controls/table/native_table_win.h b/views/controls/table/native_table_win.h index d23a961..dcbc087 100644 --- a/views/controls/table/native_table_win.h +++ b/views/controls/table/native_table_win.h @@ -74,7 +74,7 @@ class NativeTableWin : public NativeControlWin, public NativeTableWrapper { virtual void OnMiddleClick(); // Overridden from NativeControl. Notifies the observer. - virtual bool OnKeyDown(base::KeyboardCode virtual_keycode); + virtual bool OnKeyDown(app::KeyboardCode virtual_keycode); // Custom drawing of our icons. LRESULT OnCustomDraw(NMLVCUSTOMDRAW* draw_info); diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index 510d536..e397ce9 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -1488,7 +1488,7 @@ void TableView::OnSelectedStateChanged() { } } -bool TableView::OnKeyDown(base::KeyboardCode virtual_keycode) { +bool TableView::OnKeyDown(app::KeyboardCode virtual_keycode) { if (!ignore_listview_change_ && table_view_observer_) { table_view_observer_->OnKeyDown(virtual_keycode); } diff --git a/views/controls/table/table_view.h b/views/controls/table/table_view.h index 2799c62..9444d96b 100644 --- a/views/controls/table/table_view.h +++ b/views/controls/table/table_view.h @@ -16,8 +16,8 @@ typedef struct tagNMLVCUSTOMDRAW NMLVCUSTOMDRAW; #include <map> #include <vector> +#include "app/keyboard_codes.h" #include "app/table_model_observer.h" -#include "base/keyboard_codes.h" #include "third_party/skia/include/core/SkColor.h" #if defined(OS_WIN) // TODO(port): remove the ifdef when native_control.h is ported. @@ -257,7 +257,7 @@ class TableView : public NativeControl, virtual void OnMiddleClick(); // Overridden from NativeControl. Notifies the observer. - virtual bool OnKeyDown(base::KeyboardCode virtual_keycode); + virtual bool OnKeyDown(app::KeyboardCode virtual_keycode); // Invoked to customize the colors or font at a particular cell. If you // change the colors or font, return true. This is only invoked if diff --git a/views/controls/table/table_view_observer.h b/views/controls/table/table_view_observer.h index 07a1e86..86fff7a 100644 --- a/views/controls/table/table_view_observer.h +++ b/views/controls/table/table_view_observer.h @@ -6,7 +6,7 @@ #define VIEWS_CONTROLS_TABLE_TABLE_VIEW_OBSERVER_H_ #pragma once -#include "base/keyboard_codes.h" +#include "app/keyboard_codes.h" namespace views { @@ -28,7 +28,7 @@ class TableViewObserver { virtual void OnMiddleClick() {} // Optional method invoked when the user hits a key with the table in focus. - virtual void OnKeyDown(base::KeyboardCode virtual_keycode) {} + virtual void OnKeyDown(app::KeyboardCode virtual_keycode) {} // Invoked when the user presses the delete key. virtual void OnTableViewDelete(TableView* table_view) {} diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index fc4ad8b..c91dcdf 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -8,11 +8,11 @@ #include "app/clipboard/clipboard.h" #include "app/clipboard/scoped_clipboard_writer.h" +#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/win_util.h" #include "base/i18n/rtl.h" -#include "base/keyboard_codes.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/win_util.h" @@ -313,13 +313,13 @@ bool NativeTextfieldWin::GetAcceleratorForCommandId(int command_id, // anywhere so we need to check for them explicitly here. switch (command_id) { case IDS_APP_CUT: - *accelerator = views::Accelerator(base::VKEY_X, false, true, false); + *accelerator = views::Accelerator(app::VKEY_X, false, true, false); return true; case IDS_APP_COPY: - *accelerator = views::Accelerator(base::VKEY_C, false, true, false); + *accelerator = views::Accelerator(app::VKEY_C, false, true, false); return true; case IDS_APP_PASTE: - *accelerator = views::Accelerator(base::VKEY_V, false, true, false); + *accelerator = views::Accelerator(app::VKEY_V, false, true, false); return true; } return container_view_->GetWidget()->GetAccelerator(command_id, accelerator); @@ -868,7 +868,7 @@ void NativeTextfieldWin::HandleKeystroke(UINT message, if (!handled) { OnBeforePossibleChange(); - if (key == base::VKEY_HOME || key == base::VKEY_END) { + if (key == app::VKEY_HOME || key == app::VKEY_END) { // DefWindowProc() might reset the keyboard layout when it receives a // keydown event for VKEY_HOME or VKEY_END. When the window was created // with WS_EX_LAYOUTRTL and the current keyboard layout is not a RTL one, diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc index 43f0897..fc8d081 100644 --- a/views/controls/textfield/textfield.cc +++ b/views/controls/textfield/textfield.cc @@ -10,7 +10,7 @@ #include <string> -#include "base/keyboard_codes.h" +#include "app/keyboard_codes.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "gfx/insets.h" @@ -19,7 +19,7 @@ #include "views/widget/widget.h" #if defined(OS_LINUX) -#include "base/keyboard_code_conversion_gtk.h" +#include "app/keyboard_code_conversion_gtk.h" #elif defined(OS_WIN) #include "app/win_util.h" #include "base/win_util.h" @@ -239,14 +239,14 @@ void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) { // TODO(hamaji): Figure out which keyboard combinations we need to add here, // similar to LocationBarView::SkipDefaultKeyEventProcessing. - base::KeyboardCode key = e.GetKeyCode(); - if (key == base::VKEY_BACK) + app::KeyboardCode key = e.GetKeyCode(); + if (key == app::VKEY_BACK) return true; // We'll handle BackSpace ourselves. #if defined(OS_WIN) // We don't translate accelerators for ALT + NumPad digit on Windows, they are // used for entering special characters. We do translate alt-home. - if (e.IsAltDown() && (key != base::VKEY_HOME) && + if (e.IsAltDown() && (key != app::VKEY_HOME) && win_util::IsNumPadDigit(key, e.IsExtendedKey())) return true; #endif @@ -332,12 +332,12 @@ std::string Textfield::GetClassName() const { return kViewClassName; } -base::KeyboardCode Textfield::Keystroke::GetKeyboardCode() const { +app::KeyboardCode Textfield::Keystroke::GetKeyboardCode() const { #if defined(OS_WIN) - return static_cast<base::KeyboardCode>(key_); + return static_cast<app::KeyboardCode>(key_); #else - return static_cast<base::KeyboardCode>( - base::WindowsKeyCodeForGdkKeyCode(event_.keyval)); + return static_cast<app::KeyboardCode>( + app::WindowsKeyCodeForGdkKeyCode(event_.keyval)); #endif } diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h index 564243e..3bd6c31 100644 --- a/views/controls/textfield/textfield.h +++ b/views/controls/textfield/textfield.h @@ -14,8 +14,8 @@ #include <string> +#include "app/keyboard_codes.h" #include "base/basictypes.h" -#include "base/keyboard_codes.h" #if !defined(OS_LINUX) #include "base/logging.h" #endif @@ -65,7 +65,7 @@ class Textfield : public View { } const GdkEventKey* event() const { return &event_; } #endif - base::KeyboardCode GetKeyboardCode() const; + app::KeyboardCode GetKeyboardCode() const; bool IsControlHeld() const; bool IsShiftHeld() const; diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc index eba1a31..27edeaf 100644 --- a/views/controls/tree/tree_view.cc +++ b/views/controls/tree/tree_view.cc @@ -6,10 +6,11 @@ #include <vector> +#include "app/keyboard_code_conversion_win.h" +#include "app/keyboard_codes.h" #include "app/l10n_util_win.h" #include "app/resource_bundle.h" #include "base/i18n/rtl.h" -#include "base/keyboard_codes.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/win_util.h" @@ -448,7 +449,7 @@ LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) { NMTVKEYDOWN* key_down_message = reinterpret_cast<NMTVKEYDOWN*>(l_param); controller_->OnTreeViewKeyDown( - win_util::WinToKeyboardCode(key_down_message->wVKey)); + app::KeyboardCodeForWindowsKeyCode(key_down_message->wVKey)); } break; @@ -458,7 +459,7 @@ LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) { return 0; } -bool TreeView::OnKeyDown(base::KeyboardCode virtual_key_code) { +bool TreeView::OnKeyDown(app::KeyboardCode virtual_key_code) { if (virtual_key_code == VK_F2) { if (!GetEditingNode()) { TreeModelNode* selected_node = GetSelectedNode(); @@ -466,7 +467,7 @@ bool TreeView::OnKeyDown(base::KeyboardCode virtual_key_code) { StartEditing(selected_node); } return true; - } else if (virtual_key_code == base::VKEY_RETURN && !process_enter_) { + } else if (virtual_key_code == app::VKEY_RETURN && !process_enter_) { Widget* widget = GetWidget(); DCHECK(widget); Accelerator accelerator(Accelerator(virtual_key_code, diff --git a/views/controls/tree/tree_view.h b/views/controls/tree/tree_view.h index cbcfbe7..593219c 100644 --- a/views/controls/tree/tree_view.h +++ b/views/controls/tree/tree_view.h @@ -11,9 +11,9 @@ #include <map> +#include "app/keyboard_codes.h" #include "app/tree_model.h" #include "base/basictypes.h" -#include "base/keyboard_codes.h" #include "views/controls/native_control.h" namespace views { @@ -36,7 +36,7 @@ class TreeViewController { } // Invoked when a key is pressed on the tree view. - virtual void OnTreeViewKeyDown(base::KeyboardCode keycode) {} + virtual void OnTreeViewKeyDown(app::KeyboardCode keycode) {} }; // TreeView ------------------------------------------------------------------- @@ -181,7 +181,7 @@ class TreeView : public NativeControl, TreeModelObserver { // We pay attention to key down for two reasons: to circumvent VK_ENTER from // toggling the expaned state when processes_enter_ is false, and to have F2 // start editting. - virtual bool OnKeyDown(base::KeyboardCode virtual_key_code); + virtual bool OnKeyDown(app::KeyboardCode virtual_key_code); virtual void OnContextMenu(const POINT& location); |