summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-13 17:36:09 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-13 17:36:09 +0000
commitb6d81261a469240e25b41e7125bb7166ca3d35bb (patch)
tree9ddaf52100915560ce5c3d0167e79ef4a26aec56 /views
parent917a44b0724089630cb1d962a9383df7a1deaf7e (diff)
downloadchromium_src-b6d81261a469240e25b41e7125bb7166ca3d35bb.zip
chromium_src-b6d81261a469240e25b41e7125bb7166ca3d35bb.tar.gz
chromium_src-b6d81261a469240e25b41e7125bb7166ca3d35bb.tar.bz2
Move app/key* to ui/base/keycodes/*
BUG=none TEST=none TBR=brettw Review URL: http://codereview.chromium.org/6246001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/accelerator.cc30
-rw-r--r--views/accelerator.h4
-rw-r--r--views/controls/button/custom_button.cc8
-rw-r--r--views/controls/button/menu_button.cc8
-rw-r--r--views/controls/button/native_button.cc6
-rw-r--r--views/controls/combobox/combobox.cc4
-rw-r--r--views/controls/link.cc10
-rw-r--r--views/controls/menu/menu_controller.cc24
-rw-r--r--views/controls/menu/menu_win.cc4
-rw-r--r--views/controls/menu/native_menu_gtk.cc8
-rw-r--r--views/controls/menu/native_menu_win.cc4
-rw-r--r--views/controls/native_control.cc6
-rw-r--r--views/controls/native_control.h4
-rw-r--r--views/controls/scrollbar/bitmap_scroll_bar.cc18
-rw-r--r--views/controls/scrollbar/native_scroll_bar_gtk.cc18
-rw-r--r--views/controls/scrollbar/native_scroll_bar_win.cc18
-rw-r--r--views/controls/tabbed_pane/tabbed_pane.cc8
-rw-r--r--views/controls/table/group_table_view.cc10
-rw-r--r--views/controls/table/group_table_view.h2
-rw-r--r--views/controls/table/native_table_win.cc2
-rw-r--r--views/controls/table/native_table_win.h2
-rw-r--r--views/controls/table/table_view.cc2
-rw-r--r--views/controls/table/table_view.h5
-rw-r--r--views/controls/table/table_view_observer.h4
-rw-r--r--views/controls/textfield/native_textfield_views.cc156
-rw-r--r--views/controls/textfield/native_textfield_views_unittest.cc118
-rw-r--r--views/controls/textfield/native_textfield_win.cc14
-rw-r--r--views/controls/textfield/textfield.cc10
-rw-r--r--views/controls/textfield/textfield.h10
-rw-r--r--views/controls/tree/tree_view.cc10
-rw-r--r--views/controls/tree/tree_view.h6
-rw-r--r--views/event.cc2
-rw-r--r--views/event.h10
-rw-r--r--views/event_gtk.cc4
-rw-r--r--views/event_win.cc2
-rw-r--r--views/event_x.cc4
-rw-r--r--views/examples/table2_example.h2
-rw-r--r--views/examples/table_example.h2
-rw-r--r--views/focus/accelerator_handler_gtk_unittest.cc4
-rw-r--r--views/focus/accelerator_handler_win.cc6
-rw-r--r--views/focus/focus_manager.cc12
-rw-r--r--views/focus/focus_manager_unittest.cc90
-rw-r--r--views/view_unittest.cc8
-rw-r--r--views/widget/root_view.cc6
-rw-r--r--views/widget/widget_gtk.cc10
-rw-r--r--views/widget/widget_win.cc6
-rw-r--r--views/window/dialog_client_view.cc10
-rw-r--r--views/window/window_win.cc4
48 files changed, 358 insertions, 357 deletions
diff --git a/views/accelerator.cc b/views/accelerator.cc
index de1e131..c9d4f39 100644
--- a/views/accelerator.cc
+++ b/views/accelerator.cc
@@ -22,46 +22,46 @@ namespace views {
string16 Accelerator::GetShortcutText() const {
int string_id = 0;
switch(key_code_) {
- case app::VKEY_TAB:
+ case ui::VKEY_TAB:
string_id = IDS_APP_TAB_KEY;
break;
- case app::VKEY_RETURN:
+ case ui::VKEY_RETURN:
string_id = IDS_APP_ENTER_KEY;
break;
- case app::VKEY_ESCAPE:
+ case ui::VKEY_ESCAPE:
string_id = IDS_APP_ESC_KEY;
break;
- case app::VKEY_PRIOR:
+ case ui::VKEY_PRIOR:
string_id = IDS_APP_PAGEUP_KEY;
break;
- case app::VKEY_NEXT:
+ case ui::VKEY_NEXT:
string_id = IDS_APP_PAGEDOWN_KEY;
break;
- case app::VKEY_END:
+ case ui::VKEY_END:
string_id = IDS_APP_END_KEY;
break;
- case app::VKEY_HOME:
+ case ui::VKEY_HOME:
string_id = IDS_APP_HOME_KEY;
break;
- case app::VKEY_INSERT:
+ case ui::VKEY_INSERT:
string_id = IDS_APP_INSERT_KEY;
break;
- case app::VKEY_DELETE:
+ case ui::VKEY_DELETE:
string_id = IDS_APP_DELETE_KEY;
break;
- case app::VKEY_LEFT:
+ case ui::VKEY_LEFT:
string_id = IDS_APP_LEFT_ARROW_KEY;
break;
- case app::VKEY_RIGHT:
+ case ui::VKEY_RIGHT:
string_id = IDS_APP_RIGHT_ARROW_KEY;
break;
- case app::VKEY_BACK:
+ case ui::VKEY_BACK:
string_id = IDS_APP_BACKSPACE_KEY;
break;
- case app::VKEY_F1:
+ case ui::VKEY_F1:
string_id = IDS_APP_F1_KEY;
break;
- case app::VKEY_F11:
+ case ui::VKEY_F11:
string_id = IDS_APP_F11_KEY;
break;
default:
@@ -86,7 +86,7 @@ string16 Accelerator::GetShortcutText() const {
#elif defined(OS_LINUX)
const gchar* name = NULL;
switch (key_code_) {
- case app::VKEY_OEM_2:
+ case ui::VKEY_OEM_2:
name = static_cast<const gchar*>("/");
break;
default:
diff --git a/views/accelerator.h b/views/accelerator.h
index 05fa83b..81e3043 100644
--- a/views/accelerator.h
+++ b/views/accelerator.h
@@ -24,10 +24,10 @@ class Accelerator : public menus::Accelerator {
public:
Accelerator() : menus::Accelerator() {}
- Accelerator(app::KeyboardCode keycode, int modifiers)
+ Accelerator(ui::KeyboardCode keycode, int modifiers)
: menus::Accelerator(keycode, modifiers) {}
- Accelerator(app::KeyboardCode keycode,
+ Accelerator(ui::KeyboardCode keycode,
bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
key_code_ = keycode;
modifiers_ = 0;
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index baf0209..56abaeb 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 "ui/base/animation/throb_animation.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/screen.h"
namespace views {
@@ -203,9 +203,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() == app::VKEY_SPACE) {
+ if (e.GetKeyCode() == ui::VKEY_SPACE) {
SetState(BS_PUSHED);
- } else if (e.GetKeyCode() == app::VKEY_RETURN) {
+ } else if (e.GetKeyCode() == ui::VKEY_RETURN) {
SetState(BS_NORMAL);
NotifyClick(e);
} else {
@@ -215,7 +215,7 @@ bool CustomButton::OnKeyPressed(const KeyEvent& e) {
}
bool CustomButton::OnKeyReleased(const KeyEvent& e) {
- if ((state_ == BS_DISABLED) || (e.GetKeyCode() != app::VKEY_SPACE))
+ if ((state_ == BS_DISABLED) || (e.GetKeyCode() != ui::VKEY_SPACE))
return false;
SetState(BS_NORMAL);
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index e7d746a..ad51681 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -220,10 +220,10 @@ void MenuButton::OnMouseReleased(const MouseEvent& e,
}
bool MenuButton::OnKeyPressed(const KeyEvent& e) {
- if (e.GetKeyCode() == app::VKEY_SPACE ||
- e.GetKeyCode() == app::VKEY_RETURN ||
- e.GetKeyCode() == app::VKEY_UP ||
- e.GetKeyCode() == app::VKEY_DOWN) {
+ if (e.GetKeyCode() == ui::VKEY_SPACE ||
+ e.GetKeyCode() == ui::VKEY_RETURN ||
+ e.GetKeyCode() == ui::VKEY_UP ||
+ e.GetKeyCode() == ui::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 84eee12..650bf0f 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 "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/native/native_view_host.h"
#if defined(OS_WIN)
@@ -88,9 +88,9 @@ void NativeButton::SetIsDefault(bool is_default) {
if (is_default == is_default_)
return;
if (is_default)
- AddAccelerator(Accelerator(app::VKEY_RETURN, false, false, false));
+ AddAccelerator(Accelerator(ui::VKEY_RETURN, false, false, false));
else
- RemoveAccelerator(Accelerator(app::VKEY_RETURN, false, false, false));
+ RemoveAccelerator(Accelerator(ui::VKEY_RETURN, false, false, false));
SetAppearsAsDefault(is_default);
}
diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc
index 9d1b1f0..49dd4d3 100644
--- a/views/controls/combobox/combobox.cc
+++ b/views/controls/combobox/combobox.cc
@@ -5,9 +5,9 @@
#include "views/controls/combobox/combobox.h"
#include "app/combobox_model.h"
-#include "app/keyboard_codes.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/combobox/native_combobox_wrapper.h"
#include "views/controls/native/native_view_host.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() != app::VKEY_ESCAPE ||
+ if (e.GetKeyCode() != ui::VKEY_ESCAPE ||
e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) {
return false;
}
diff --git a/views/controls/link.cc b/views/controls/link.cc
index 6101e49..e83411e 100644
--- a/views/controls/link.cc
+++ b/views/controls/link.cc
@@ -8,10 +8,10 @@
#include <gdk/gdk.h>
#endif
-#include "app/keyboard_codes.h"
#include "base/logging.h"
#include "gfx/color_utils.h"
#include "gfx/font.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/event.h"
#if defined(OS_LINUX)
@@ -126,8 +126,8 @@ void Link::OnMouseReleased(const MouseEvent& e, bool canceled) {
}
bool Link::OnKeyPressed(const KeyEvent& e) {
- bool activate = ((e.GetKeyCode() == app::VKEY_SPACE) ||
- (e.GetKeyCode() == app::VKEY_RETURN));
+ bool activate = ((e.GetKeyCode() == ui::VKEY_SPACE) ||
+ (e.GetKeyCode() == ui::VKEY_RETURN));
if (!activate)
return false;
@@ -144,8 +144,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() == app::VKEY_SPACE) ||
- (e.GetKeyCode() == app::VKEY_RETURN);
+ return (e.GetKeyCode() == ui::VKEY_SPACE) ||
+ (e.GetKeyCode() == ui::VKEY_RETURN);
}
AccessibilityTypes::Role Link::GetAccessibleRole() {
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc
index 31d21f0..27b059e 100644
--- a/views/controls/menu/menu_controller.cc
+++ b/views/controls/menu/menu_controller.cc
@@ -4,13 +4,13 @@
#include "views/controls/menu/menu_controller.h"
-#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "base/i18n/rtl.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "gfx/canvas_skia.h"
#include "ui/base/dragdrop/os_exchange_data.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/menu_scroll_view_container.h"
#include "views/controls/menu/submenu_view.h"
@@ -22,7 +22,7 @@
#include "views/widget/widget.h"
#if defined(OS_LINUX)
-#include "app/keyboard_code_conversion_gtk.h"
+#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
#endif
#if defined(TOUCH_UI)
@@ -830,8 +830,8 @@ bool MenuController::Dispatch(GdkEvent* event) {
switch (event->type) {
case GDK_KEY_PRESS: {
- app::KeyboardCode win_keycode =
- app::WindowsKeyCodeForGdkKeyCode(event->key.keyval);
+ ui::KeyboardCode win_keycode =
+ ui::WindowsKeyCodeForGdkKeyCode(event->key.keyval);
if (!OnKeyDown(win_keycode))
return false;
@@ -883,35 +883,35 @@ bool MenuController::OnKeyDown(int key_code
DCHECK(blocking_run_);
switch (key_code) {
- case app::VKEY_UP:
+ case ui::VKEY_UP:
IncrementSelection(-1);
break;
- case app::VKEY_DOWN:
+ case ui::VKEY_DOWN:
IncrementSelection(1);
break;
// Handling of VK_RIGHT and VK_LEFT is different depending on the UI
// layout.
- case app::VKEY_RIGHT:
+ case ui::VKEY_RIGHT:
if (base::i18n::IsRTL())
CloseSubmenu();
else
OpenSubmenuChangeSelectionIfCan();
break;
- case app::VKEY_LEFT:
+ case ui::VKEY_LEFT:
if (base::i18n::IsRTL())
OpenSubmenuChangeSelectionIfCan();
else
CloseSubmenu();
break;
- case app::VKEY_SPACE:
+ case ui::VKEY_SPACE:
SendAcceleratorToHotTrackedView();
break;
- case app::VKEY_RETURN:
+ case ui::VKEY_RETURN:
if (pending_state_.item) {
if (pending_state_.item->HasSubmenu()) {
OpenSubmenuChangeSelectionIfCan();
@@ -923,7 +923,7 @@ bool MenuController::OnKeyDown(int key_code
}
break;
- case app::VKEY_ESCAPE:
+ case ui::VKEY_ESCAPE:
if (!state_.item->GetParentMenuItem() ||
(!state_.item->GetParentMenuItem()->GetParentMenuItem() &&
(!state_.item->HasSubmenu() ||
@@ -978,7 +978,7 @@ bool MenuController::SendAcceleratorToHotTrackedView() {
if (!hot_view)
return false;
- Accelerator accelerator(app::VKEY_RETURN, false, false, false);
+ Accelerator accelerator(ui::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 b2ade18..6776a8b 100644
--- a/views/controls/menu/menu_win.cc
+++ b/views/controls/menu/menu_win.cc
@@ -6,7 +6,6 @@
#include <string>
-#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
#include "app/win/window_impl.h"
@@ -16,6 +15,7 @@
#include "gfx/canvas_skia.h"
#include "gfx/font.h"
#include "gfx/rect.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/accelerator.h"
namespace views {
@@ -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(app::VKEY_UNKNOWN, false, false, false);
+ views::Accelerator accelerator(ui::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 3aa6c3e..3aecff8 100644
--- a/views/controls/menu/native_menu_gtk.cc
+++ b/views/controls/menu/native_menu_gtk.cc
@@ -8,8 +8,6 @@
#include <map>
#include <string>
-#include "app/keyboard_code_conversion_gtk.h"
-#include "app/keyboard_codes.h"
#include "app/menus/menu_model.h"
#include "base/i18n/rtl.h"
#include "base/message_loop.h"
@@ -18,6 +16,8 @@
#include "gfx/font.h"
#include "gfx/gtk_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
#include "views/accelerator.h"
#include "views/controls/menu/menu_2.h"
#include "views/controls/menu/nested_dispatcher_gtk.h"
@@ -388,7 +388,7 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index,
submenu->GetNativeMenu());
}
- views::Accelerator accelerator(app::VKEY_UNKNOWN, false, false, false);
+ views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false);
if (accel_group && model_->GetAcceleratorAt(index, &accelerator)) {
int gdk_modifiers = 0;
if (accelerator.IsShiftDown())
@@ -398,7 +398,7 @@ GtkWidget* NativeMenuGtk::AddMenuItemAt(int index,
if (accelerator.IsAltDown())
gdk_modifiers |= GDK_MOD1_MASK;
gtk_widget_add_accelerator(menu_item, "activate", accel_group,
- app::GdkKeyCodeForWindowsKeyCode(accelerator.GetKeyCode(), false),
+ ui::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 cf36c8e..efdaa67 100644
--- a/views/controls/menu/native_menu_win.cc
+++ b/views/controls/menu/native_menu_win.cc
@@ -4,7 +4,6 @@
#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 "app/win/hwnd_util.h"
@@ -13,6 +12,7 @@
#include "gfx/canvas_skia.h"
#include "gfx/font.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/accelerator.h"
#include "views/controls/menu/menu_2.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(app::VKEY_UNKNOWN, false, false, false);
+ views::Accelerator accelerator(ui::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 9434a50..b684a82 100644
--- a/views/controls/native_control.cc
+++ b/views/controls/native_control.cc
@@ -10,14 +10,14 @@
#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 "app/win/hwnd_util.h"
#include "app/view_prop.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "gfx/native_theme_win.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/base/keycodes/keyboard_code_conversion_win.h"
#include "views/background.h"
#include "views/border.h"
#include "views/controls/native/native_view_host.h"
@@ -371,7 +371,7 @@ LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window,
DCHECK(original_handler);
if (message == WM_KEYDOWN &&
- native_control->OnKeyDown(app::KeyboardCodeForWindowsKeyCode(w_param))) {
+ native_control->OnKeyDown(ui::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 75a2a49..60f447c 100644
--- a/views/controls/native_control.h
+++ b/views/controls/native_control.h
@@ -8,7 +8,7 @@
#include <windows.h>
-#include "app/keyboard_codes.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/view.h"
namespace views {
@@ -82,7 +82,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(app::KeyboardCode virtual_key_code) { return false; }
+ virtual bool OnKeyDown(ui::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 12f98c1..5a426e1 100644
--- a/views/controls/scrollbar/bitmap_scroll_bar.cc
+++ b/views/controls/scrollbar/bitmap_scroll_bar.cc
@@ -8,7 +8,6 @@
#include "views/screen.h"
#endif
-#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
@@ -18,6 +17,7 @@
#include "gfx/canvas.h"
#include "grit/app_strings.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/menu/menu.h"
#include "views/controls/scroll_view.h"
#include "views/widget/widget.h"
@@ -498,32 +498,32 @@ bool BitmapScrollBar::OnMouseWheel(const MouseWheelEvent& event) {
bool BitmapScrollBar::OnKeyPressed(const KeyEvent& event) {
ScrollAmount amount = SCROLL_NONE;
switch (event.GetKeyCode()) {
- case app::VKEY_UP:
+ case ui::VKEY_UP:
if (!IsHorizontal())
amount = SCROLL_PREV_LINE;
break;
- case app::VKEY_DOWN:
+ case ui::VKEY_DOWN:
if (!IsHorizontal())
amount = SCROLL_NEXT_LINE;
break;
- case app::VKEY_LEFT:
+ case ui::VKEY_LEFT:
if (IsHorizontal())
amount = SCROLL_PREV_LINE;
break;
- case app::VKEY_RIGHT:
+ case ui::VKEY_RIGHT:
if (IsHorizontal())
amount = SCROLL_NEXT_LINE;
break;
- case app::VKEY_PRIOR:
+ case ui::VKEY_PRIOR:
amount = SCROLL_PREV_PAGE;
break;
- case app::VKEY_NEXT:
+ case ui::VKEY_NEXT:
amount = SCROLL_NEXT_PAGE;
break;
- case app::VKEY_HOME:
+ case ui::VKEY_HOME:
amount = SCROLL_START;
break;
- case app::VKEY_END:
+ case ui::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 6f318ec..0a1bc73 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 "app/keyboard_codes_posix.h"
+#include "ui/base/keycodes/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 app::VKEY_UP:
+ case ui::VKEY_UP:
if (!native_scroll_bar_->IsHorizontal())
MoveStep(false /* negative */);
break;
- case app::VKEY_DOWN:
+ case ui::VKEY_DOWN:
if (!native_scroll_bar_->IsHorizontal())
MoveStep(true /* positive */);
break;
- case app::VKEY_LEFT:
+ case ui::VKEY_LEFT:
if (native_scroll_bar_->IsHorizontal())
MoveStep(false /* negative */);
break;
- case app::VKEY_RIGHT:
+ case ui::VKEY_RIGHT:
if (native_scroll_bar_->IsHorizontal())
MoveStep(true /* positive */);
break;
- case app::VKEY_PRIOR:
+ case ui::VKEY_PRIOR:
MovePage(false /* negative */);
break;
- case app::VKEY_NEXT:
+ case ui::VKEY_NEXT:
MovePage(true /* positive */);
break;
- case app::VKEY_HOME:
+ case ui::VKEY_HOME:
MoveTo(0);
break;
- case app::VKEY_END:
+ case ui::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 0aea447c..6286305 100644
--- a/views/controls/scrollbar/native_scroll_bar_win.cc
+++ b/views/controls/scrollbar/native_scroll_bar_win.cc
@@ -7,9 +7,9 @@
#include <algorithm>
#include <string>
-#include "app/keyboard_codes.h"
#include "app/win/window_impl.h"
#include "base/message_loop.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/scrollbar/native_scroll_bar.h"
#include "views/controls/scrollbar/scroll_bar.h"
#include "views/widget/widget.h"
@@ -231,31 +231,31 @@ bool NativeScrollBarWin::OnKeyPressed(const KeyEvent& event) {
return false;
int code = -1;
switch (event.GetKeyCode()) {
- case app::VKEY_UP:
+ case ui::VKEY_UP:
if (!native_scroll_bar_->IsHorizontal())
code = SB_LINEUP;
break;
- case app::VKEY_PRIOR:
+ case ui::VKEY_PRIOR:
code = SB_PAGEUP;
break;
- case app::VKEY_NEXT:
+ case ui::VKEY_NEXT:
code = SB_PAGEDOWN;
break;
- case app::VKEY_DOWN:
+ case ui::VKEY_DOWN:
if (!native_scroll_bar_->IsHorizontal())
code = SB_LINEDOWN;
break;
- case app::VKEY_HOME:
+ case ui::VKEY_HOME:
code = SB_TOP;
break;
- case app::VKEY_END:
+ case ui::VKEY_END:
code = SB_BOTTOM;
break;
- case app::VKEY_LEFT:
+ case ui::VKEY_LEFT:
if (native_scroll_bar_->IsHorizontal())
code = SB_LINELEFT;
break;
- case app::VKEY_RIGHT:
+ case ui::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 429e4c4..6fb07ea 100644
--- a/views/controls/tabbed_pane/tabbed_pane.cc
+++ b/views/controls/tabbed_pane/tabbed_pane.cc
@@ -4,8 +4,8 @@
#include "views/controls/tabbed_pane/tabbed_pane.h"
-#include "app/keyboard_codes.h"
#include "base/logging.h"
+#include "ui/base/keycodes/keyboard_codes.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() ==
- app::VKEY_TAB && accelerator.IsCtrlDown());
+ ui::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(app::VKEY_TAB, true, true, false));
+ AddAccelerator(views::Accelerator(ui::VKEY_TAB, true, true, false));
// Ctrl+Tab
- AddAccelerator(views::Accelerator(app::VKEY_TAB, false, true, false));
+ AddAccelerator(views::Accelerator(ui::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 4d34c56..cf35d73 100644
--- a/views/controls/table/group_table_view.cc
+++ b/views/controls/table/group_table_view.cc
@@ -63,7 +63,7 @@ void GroupTableView::SyncSelection() {
}
}
-bool GroupTableView::OnKeyDown(app::KeyboardCode virtual_keycode) {
+bool GroupTableView::OnKeyDown(ui::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:
@@ -89,8 +89,8 @@ bool GroupTableView::OnKeyDown(app::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 != app::VKEY_UP) &&
- (virtual_keycode != app::VKEY_DOWN)) {
+ if ((virtual_keycode != ui::VKEY_UP) &&
+ (virtual_keycode != ui::VKEY_DOWN)) {
return TableView::OnKeyDown(virtual_keycode);
}
@@ -118,10 +118,10 @@ bool GroupTableView::OnKeyDown(app::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 == app::VKEY_UP) {
+ if (virtual_keycode == ui::VKEY_UP) {
SetFocusOnItem(group_range.start);
} else {
- DCHECK_EQ(virtual_keycode, app::VKEY_DOWN);
+ DCHECK_EQ(virtual_keycode, ui::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 adf0bac..8ce6270 100644
--- a/views/controls/table/group_table_view.h
+++ b/views/controls/table/group_table_view.h
@@ -57,7 +57,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(app::KeyboardCode virtual_keycode);
+ virtual bool OnKeyDown(ui::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 35769c6..d660dbb 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(app::KeyboardCode virtual_keycode) {
+bool NativeTableWin::OnKeyDown(ui::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 dcbc087..548f070 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(app::KeyboardCode virtual_keycode);
+ virtual bool OnKeyDown(ui::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 d35b074..45b0bf1 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -1503,7 +1503,7 @@ void TableView::OnSelectedStateChanged() {
}
}
-bool TableView::OnKeyDown(app::KeyboardCode virtual_keycode) {
+bool TableView::OnKeyDown(ui::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 83ac85a..cae1a64b 100644
--- a/views/controls/table/table_view.h
+++ b/views/controls/table/table_view.h
@@ -16,10 +16,11 @@ typedef struct tagNMLVCUSTOMDRAW NMLVCUSTOMDRAW;
#include <map>
#include <vector>
-#include "app/keyboard_codes.h"
#include "app/table_model_observer.h"
#include "base/gtest_prod_util.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+
#if defined(OS_WIN)
// TODO(port): remove the ifdef when native_control.h is ported.
#include "views/controls/native_control.h"
@@ -258,7 +259,7 @@ class TableView : public NativeControl,
virtual void OnMiddleClick();
// Overridden from NativeControl. Notifies the observer.
- virtual bool OnKeyDown(app::KeyboardCode virtual_keycode);
+ virtual bool OnKeyDown(ui::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 86fff7a..3444118 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 "app/keyboard_codes.h"
+#include "ui/base/keycodes/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(app::KeyboardCode virtual_keycode) {}
+ virtual void OnKeyDown(ui::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_views.cc b/views/controls/textfield/native_textfield_views.cc
index 06ceb82..39677a7 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -427,52 +427,52 @@ void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) {
bool NativeTextfieldViews::HandleKeyEvent(const KeyEvent& key_event) {
// TODO(oshima): handle IME.
if (key_event.GetType() == views::Event::ET_KEY_PRESSED) {
- app::KeyboardCode key_code = key_event.GetKeyCode();
+ ui::KeyboardCode key_code = key_event.GetKeyCode();
// TODO(oshima): shift-tab does not work. Figure out why and fix.
- if (key_code == app::VKEY_TAB)
+ if (key_code == ui::VKEY_TAB)
return false;
bool selection = key_event.IsShiftDown();
bool control = key_event.IsControlDown();
bool text_changed = false;
bool cursor_changed = false;
switch (key_code) {
- case app::VKEY_A:
+ case ui::VKEY_A:
if (control) {
model_->SelectAll();
cursor_changed = true;
}
break;
- case app::VKEY_X:
+ case ui::VKEY_X:
if (control)
text_changed = model_->Cut();
break;
- case app::VKEY_C:
+ case ui::VKEY_C:
if (control)
model_->Copy();
break;
- case app::VKEY_V:
+ case ui::VKEY_V:
if (control)
text_changed = model_->Paste();
break;
- case app::VKEY_RIGHT:
+ case ui::VKEY_RIGHT:
control ? model_->MoveCursorToNextWord(selection)
: model_->MoveCursorRight(selection);
cursor_changed = true;
break;
- case app::VKEY_LEFT:
+ case ui::VKEY_LEFT:
control ? model_->MoveCursorToPreviousWord(selection)
: model_->MoveCursorLeft(selection);
cursor_changed = true;
break;
- case app::VKEY_END:
+ case ui::VKEY_END:
model_->MoveCursorToEnd(selection);
cursor_changed = true;
break;
- case app::VKEY_HOME:
+ case ui::VKEY_HOME:
model_->MoveCursorToStart(selection);
cursor_changed = true;
break;
- case app::VKEY_BACK:
+ case ui::VKEY_BACK:
if (!model_->HasSelection()) {
if (selection && control) {
// If both shift and control are pressed, then erase upto the
@@ -490,7 +490,7 @@ bool NativeTextfieldViews::HandleKeyEvent(const KeyEvent& key_event) {
text_changed = model_->Backspace();
cursor_changed = true;
break;
- case app::VKEY_DELETE:
+ case ui::VKEY_DELETE:
if (!model_->HasSelection()) {
if (selection && control) {
// If both shift and control are pressed, then erase upto the
@@ -507,7 +507,7 @@ bool NativeTextfieldViews::HandleKeyEvent(const KeyEvent& key_event) {
}
text_changed = model_->Delete();
break;
- case app::VKEY_INSERT:
+ case ui::VKEY_INSERT:
insert_ = !insert_;
cursor_changed = true;
break;
@@ -544,114 +544,114 @@ bool NativeTextfieldViews::HandleKeyEvent(const KeyEvent& key_event) {
char16 NativeTextfieldViews::GetPrintableChar(const KeyEvent& key_event) {
// TODO(oshima): IME, i18n support.
// This only works for UCS-2 characters.
- app::KeyboardCode key_code = key_event.GetKeyCode();
+ ui::KeyboardCode key_code = key_event.GetKeyCode();
bool shift = key_event.IsShiftDown();
bool upper = shift ^ key_event.IsCapsLockDown();
// TODO(oshima): We should have a utility function
// under app to convert a KeyboardCode to a printable character,
// probably in keyboard_code_conversion{.h, _x
switch (key_code) {
- case app::VKEY_NUMPAD0:
+ case ui::VKEY_NUMPAD0:
return '0';
- case app::VKEY_NUMPAD1:
+ case ui::VKEY_NUMPAD1:
return '1';
- case app::VKEY_NUMPAD2:
+ case ui::VKEY_NUMPAD2:
return '2';
- case app::VKEY_NUMPAD3:
+ case ui::VKEY_NUMPAD3:
return '3';
- case app::VKEY_NUMPAD4:
+ case ui::VKEY_NUMPAD4:
return '4';
- case app::VKEY_NUMPAD5:
+ case ui::VKEY_NUMPAD5:
return '5';
- case app::VKEY_NUMPAD6:
+ case ui::VKEY_NUMPAD6:
return '6';
- case app::VKEY_NUMPAD7:
+ case ui::VKEY_NUMPAD7:
return '7';
- case app::VKEY_NUMPAD8:
+ case ui::VKEY_NUMPAD8:
return '8';
- case app::VKEY_NUMPAD9:
+ case ui::VKEY_NUMPAD9:
return '9';
- case app::VKEY_MULTIPLY:
+ case ui::VKEY_MULTIPLY:
return '*';
- case app::VKEY_ADD:
+ case ui::VKEY_ADD:
return '+';
- case app::VKEY_SUBTRACT:
+ case ui::VKEY_SUBTRACT:
return '-';
- case app::VKEY_DECIMAL:
+ case ui::VKEY_DECIMAL:
return '.';
- case app::VKEY_DIVIDE:
+ case ui::VKEY_DIVIDE:
return '/';
- case app::VKEY_SPACE:
+ case ui::VKEY_SPACE:
return ' ';
- case app::VKEY_0:
+ case ui::VKEY_0:
return shift ? ')' : '0';
- case app::VKEY_1:
+ case ui::VKEY_1:
return shift ? '!' : '1';
- case app::VKEY_2:
+ case ui::VKEY_2:
return shift ? '@' : '2';
- case app::VKEY_3:
+ case ui::VKEY_3:
return shift ? '#' : '3';
- case app::VKEY_4:
+ case ui::VKEY_4:
return shift ? '$' : '4';
- case app::VKEY_5:
+ case ui::VKEY_5:
return shift ? '%' : '5';
- case app::VKEY_6:
+ case ui::VKEY_6:
return shift ? '^' : '6';
- case app::VKEY_7:
+ case ui::VKEY_7:
return shift ? '&' : '7';
- case app::VKEY_8:
+ case ui::VKEY_8:
return shift ? '*' : '8';
- case app::VKEY_9:
+ case ui::VKEY_9:
return shift ? '(' : '9';
- case app::VKEY_A:
- case app::VKEY_B:
- case app::VKEY_C:
- case app::VKEY_D:
- case app::VKEY_E:
- case app::VKEY_F:
- case app::VKEY_G:
- case app::VKEY_H:
- case app::VKEY_I:
- case app::VKEY_J:
- case app::VKEY_K:
- case app::VKEY_L:
- case app::VKEY_M:
- case app::VKEY_N:
- case app::VKEY_O:
- case app::VKEY_P:
- case app::VKEY_Q:
- case app::VKEY_R:
- case app::VKEY_S:
- case app::VKEY_T:
- case app::VKEY_U:
- case app::VKEY_V:
- case app::VKEY_W:
- case app::VKEY_X:
- case app::VKEY_Y:
- case app::VKEY_Z:
- return (upper ? 'A' : 'a') + (key_code - app::VKEY_A);
- case app::VKEY_OEM_1:
+ case ui::VKEY_A:
+ case ui::VKEY_B:
+ case ui::VKEY_C:
+ case ui::VKEY_D:
+ case ui::VKEY_E:
+ case ui::VKEY_F:
+ case ui::VKEY_G:
+ case ui::VKEY_H:
+ case ui::VKEY_I:
+ case ui::VKEY_J:
+ case ui::VKEY_K:
+ case ui::VKEY_L:
+ case ui::VKEY_M:
+ case ui::VKEY_N:
+ case ui::VKEY_O:
+ case ui::VKEY_P:
+ case ui::VKEY_Q:
+ case ui::VKEY_R:
+ case ui::VKEY_S:
+ case ui::VKEY_T:
+ case ui::VKEY_U:
+ case ui::VKEY_V:
+ case ui::VKEY_W:
+ case ui::VKEY_X:
+ case ui::VKEY_Y:
+ case ui::VKEY_Z:
+ return (upper ? 'A' : 'a') + (key_code - ui::VKEY_A);
+ case ui::VKEY_OEM_1:
return shift ? ':' : ';';
- case app::VKEY_OEM_PLUS:
+ case ui::VKEY_OEM_PLUS:
return shift ? '+' : '=';
- case app::VKEY_OEM_COMMA:
+ case ui::VKEY_OEM_COMMA:
return shift ? '<' : ',';
- case app::VKEY_OEM_MINUS:
+ case ui::VKEY_OEM_MINUS:
return shift ? '_' : '-';
- case app::VKEY_OEM_PERIOD:
+ case ui::VKEY_OEM_PERIOD:
return shift ? '>' : '.';
- case app::VKEY_OEM_2:
+ case ui::VKEY_OEM_2:
return shift ? '?' : '/';
- case app::VKEY_OEM_3:
+ case ui::VKEY_OEM_3:
return shift ? '~' : '`';
- case app::VKEY_OEM_4:
+ case ui::VKEY_OEM_4:
return shift ? '}' : ']';
- case app::VKEY_OEM_5:
+ case ui::VKEY_OEM_5:
return shift ? '|' : '\\';
- case app::VKEY_OEM_6:
+ case ui::VKEY_OEM_6:
return shift ? '{' : '[';
- case app::VKEY_OEM_7:
+ case ui::VKEY_OEM_7:
return shift ? '"' : '\'';
default:
return 0;
diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc
index 05775f2..9b6eb0a 100644
--- a/views/controls/textfield/native_textfield_views_unittest.cc
+++ b/views/controls/textfield/native_textfield_views_unittest.cc
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "app/keyboard_codes.h"
#include "base/utf_string_conversions.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/textfield/native_textfield_views.h"
#include "views/controls/textfield/textfield.h"
#include "views/controls/textfield/textfield_views_model.h"
@@ -88,7 +88,7 @@ class NativeTextfieldViewsTest : public ViewsTestBase,
}
protected:
- bool SendKeyEventToTextfieldViews(app::KeyboardCode key_code,
+ bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code,
bool shift,
bool control,
bool capslock) {
@@ -99,13 +99,13 @@ class NativeTextfieldViewsTest : public ViewsTestBase,
return textfield_->OnKeyPressed(event);
}
- bool SendKeyEventToTextfieldViews(app::KeyboardCode key_code,
+ bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code,
bool shift,
bool control) {
return SendKeyEventToTextfieldViews(key_code, shift, control, false);
}
- bool SendKeyEventToTextfieldViews(app::KeyboardCode key_code) {
+ bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code) {
return SendKeyEventToTextfieldViews(key_code, false, false);
}
@@ -157,21 +157,21 @@ TEST_F(NativeTextfieldViewsTest, ModelChangesTeset) {
TEST_F(NativeTextfieldViewsTest, KeyTest) {
InitTextfield(Textfield::STYLE_DEFAULT);
- SendKeyEventToTextfieldViews(app::VKEY_C, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_C, true, false);
EXPECT_STR_EQ("C", textfield_->text());
EXPECT_STR_EQ("C", last_contents_);
last_contents_.clear();
- SendKeyEventToTextfieldViews(app::VKEY_R, false, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_R, false, false);
EXPECT_STR_EQ("Cr", textfield_->text());
EXPECT_STR_EQ("Cr", last_contents_);
textfield_->SetText(ASCIIToUTF16(""));
- SendKeyEventToTextfieldViews(app::VKEY_C, true, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_C, false, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_1, false, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_1, true, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_1, true, false, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_C, true, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_C, false, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_1, false, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_1, true, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_1, true, false, false);
EXPECT_STR_EQ("cC1!!", textfield_->text());
EXPECT_STR_EQ("cC1!!", last_contents_);
}
@@ -180,34 +180,34 @@ TEST_F(NativeTextfieldViewsTest, ControlAndSelectTest) {
// Insert a test string in a textfield.
InitTextfield(Textfield::STYLE_DEFAULT);
textfield_->SetText(ASCIIToUTF16("one two three"));
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT,
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT,
true /* shift */, false /* control */);
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, true, false);
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, true, false);
EXPECT_STR_EQ("one", textfield_->GetSelectedText());
// Test word select.
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, true, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, true, true);
EXPECT_STR_EQ("one two", textfield_->GetSelectedText());
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, true, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, true, true);
EXPECT_STR_EQ("one two three", textfield_->GetSelectedText());
- SendKeyEventToTextfieldViews(app::VKEY_LEFT, true, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT, true, true);
EXPECT_STR_EQ("one two ", textfield_->GetSelectedText());
- SendKeyEventToTextfieldViews(app::VKEY_LEFT, true, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT, true, true);
EXPECT_STR_EQ("one ", textfield_->GetSelectedText());
// Replace the selected text.
- SendKeyEventToTextfieldViews(app::VKEY_Z, true, false);
- SendKeyEventToTextfieldViews(app::VKEY_E, true, false);
- SendKeyEventToTextfieldViews(app::VKEY_R, true, false);
- SendKeyEventToTextfieldViews(app::VKEY_O, true, false);
- SendKeyEventToTextfieldViews(app::VKEY_SPACE, false, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_Z, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_E, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_R, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_O, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_SPACE, false, false);
EXPECT_STR_EQ("ZERO two three", textfield_->text());
- SendKeyEventToTextfieldViews(app::VKEY_END, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_END, true, false);
EXPECT_STR_EQ("two three", textfield_->GetSelectedText());
- SendKeyEventToTextfieldViews(app::VKEY_HOME, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_HOME, true, false);
EXPECT_STR_EQ("ZERO ", textfield_->GetSelectedText());
}
@@ -219,44 +219,44 @@ TEST_F(NativeTextfieldViewsTest, InsertionDeletionTest) {
// This is ugly and should be replaced by a utility standard function.
// See comment in NativeTextfieldViews::GetPrintableChar.
char c = test_str[i];
- app::KeyboardCode code =
- c == ' ' ? app::VKEY_SPACE :
- static_cast<app::KeyboardCode>(app::VKEY_A + c - 'a');
+ ui::KeyboardCode code =
+ c == ' ' ? ui::VKEY_SPACE :
+ static_cast<ui::KeyboardCode>(ui::VKEY_A + c - 'a');
SendKeyEventToTextfieldViews(code);
}
EXPECT_STR_EQ(test_str, textfield_->text());
// Move the cursor around.
for (int i = 0; i < 6; i++) {
- SendKeyEventToTextfieldViews(app::VKEY_LEFT);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT);
}
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT);
// Delete using backspace and check resulting string.
- SendKeyEventToTextfieldViews(app::VKEY_BACK);
+ SendKeyEventToTextfieldViews(ui::VKEY_BACK);
EXPECT_STR_EQ("this is test", textfield_->text());
// Delete using delete key and check resulting string.
for (int i = 0; i < 5; i++) {
- SendKeyEventToTextfieldViews(app::VKEY_DELETE);
+ SendKeyEventToTextfieldViews(ui::VKEY_DELETE);
}
EXPECT_STR_EQ("this is ", textfield_->text());
// Select all and replace with "k".
textfield_->SelectAll();
- SendKeyEventToTextfieldViews(app::VKEY_K);
+ SendKeyEventToTextfieldViews(ui::VKEY_K);
EXPECT_STR_EQ("k", textfield_->text());
// Delete the previous word from cursor.
textfield_->SetText(ASCIIToUTF16("one two three four"));
- SendKeyEventToTextfieldViews(app::VKEY_END);
- SendKeyEventToTextfieldViews(app::VKEY_BACK, false, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_END);
+ SendKeyEventToTextfieldViews(ui::VKEY_BACK, false, true, false);
EXPECT_STR_EQ("one two three ", textfield_->text());
// Delete upto the beginning of the buffer from cursor in chromeos, do nothing
// in windows.
- SendKeyEventToTextfieldViews(app::VKEY_LEFT, false, true, false);
- SendKeyEventToTextfieldViews(app::VKEY_BACK, true, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT, false, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_BACK, true, true, false);
#if defined(OS_WIN)
EXPECT_STR_EQ("one two three ", textfield_->text());
#else
@@ -265,14 +265,14 @@ TEST_F(NativeTextfieldViewsTest, InsertionDeletionTest) {
// Delete the next word from cursor.
textfield_->SetText(ASCIIToUTF16("one two three four"));
- SendKeyEventToTextfieldViews(app::VKEY_HOME);
- SendKeyEventToTextfieldViews(app::VKEY_DELETE, false, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_HOME);
+ SendKeyEventToTextfieldViews(ui::VKEY_DELETE, false, true, false);
EXPECT_STR_EQ(" two three four", textfield_->text());
// Delete upto the end of the buffer from cursor in chromeos, do nothing
// in windows.
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, false, true, false);
- SendKeyEventToTextfieldViews(app::VKEY_DELETE, true, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, false, true, false);
+ SendKeyEventToTextfieldViews(ui::VKEY_DELETE, true, true, false);
#if defined(OS_WIN)
EXPECT_STR_EQ(" two three four", textfield_->text());
#else
@@ -291,11 +291,11 @@ TEST_F(NativeTextfieldViewsTest, PasswordTest) {
TEST_F(NativeTextfieldViewsTest, OnKeyPressReturnValueTest) {
InitTextfield(Textfield::STYLE_DEFAULT);
- EXPECT_TRUE(SendKeyEventToTextfieldViews(app::VKEY_A));
+ EXPECT_TRUE(SendKeyEventToTextfieldViews(ui::VKEY_A));
// F24, up/down key won't be handled.
- EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_F24));
- EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_UP));
- EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_DOWN));
+ EXPECT_FALSE(SendKeyEventToTextfieldViews(ui::VKEY_F24));
+ EXPECT_FALSE(SendKeyEventToTextfieldViews(ui::VKEY_UP));
+ EXPECT_FALSE(SendKeyEventToTextfieldViews(ui::VKEY_DOWN));
}
TEST_F(NativeTextfieldViewsTest, CursorMovement) {
@@ -305,23 +305,23 @@ TEST_F(NativeTextfieldViewsTest, CursorMovement) {
textfield_->SetText(ASCIIToUTF16("one two hre "));
// Send the cursor at the end.
- SendKeyEventToTextfieldViews(app::VKEY_END);
+ SendKeyEventToTextfieldViews(ui::VKEY_END);
// Ctrl+Left should move the cursor just before the last word.
- SendKeyEventToTextfieldViews(app::VKEY_LEFT, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_T);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_T);
EXPECT_STR_EQ("one two thre ", textfield_->text());
EXPECT_STR_EQ("one two thre ", last_contents_);
// Ctrl+Right should move the cursor to the end of the last word.
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_E);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_E);
EXPECT_STR_EQ("one two three ", textfield_->text());
EXPECT_STR_EQ("one two three ", last_contents_);
// Ctrl+Right again should move the cursor to the end.
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_BACK);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_BACK);
EXPECT_STR_EQ("one two three", textfield_->text());
EXPECT_STR_EQ("one two three", last_contents_);
@@ -329,21 +329,21 @@ TEST_F(NativeTextfieldViewsTest, CursorMovement) {
textfield_->SetText(ASCIIToUTF16(" ne two"));
// Send the cursor at the beginning.
- SendKeyEventToTextfieldViews(app::VKEY_HOME);
+ SendKeyEventToTextfieldViews(ui::VKEY_HOME);
// Ctrl+Right, then Ctrl+Left should move the cursor to the beginning of the
// first word.
- SendKeyEventToTextfieldViews(app::VKEY_RIGHT, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_LEFT, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_O);
+ SendKeyEventToTextfieldViews(ui::VKEY_RIGHT, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_O);
EXPECT_STR_EQ(" one two", textfield_->text());
EXPECT_STR_EQ(" one two", last_contents_);
// Ctrl+Left to move the cursor to the beginning of the first word.
- SendKeyEventToTextfieldViews(app::VKEY_LEFT, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT, false, true);
// Ctrl+Left again should move the cursor back to the very beginning.
- SendKeyEventToTextfieldViews(app::VKEY_LEFT, false, true);
- SendKeyEventToTextfieldViews(app::VKEY_DELETE);
+ SendKeyEventToTextfieldViews(ui::VKEY_LEFT, false, true);
+ SendKeyEventToTextfieldViews(ui::VKEY_DELETE);
EXPECT_STR_EQ("one two", textfield_->text());
EXPECT_STR_EQ("one two", last_contents_);
}
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index 279777f..e719f1f 100644
--- a/views/controls/textfield/native_textfield_win.cc
+++ b/views/controls/textfield/native_textfield_win.cc
@@ -6,8 +6,6 @@
#include <algorithm>
-#include "app/keyboard_codes.h"
-#include "app/keyboard_code_conversion_win.h"
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
#include "app/win/win_util.h"
@@ -20,6 +18,8 @@
#include "skia/ext/skia_utils_win.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/base/keycodes/keyboard_code_conversion_win.h"
#include "views/controls/label.h"
#include "views/controls/menu/menu_win.h"
#include "views/controls/menu/menu_2.h"
@@ -348,13 +348,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(app::VKEY_X, false, true, false);
+ *accelerator = views::Accelerator(ui::VKEY_X, false, true, false);
return true;
case IDS_APP_COPY:
- *accelerator = views::Accelerator(app::VKEY_C, false, true, false);
+ *accelerator = views::Accelerator(ui::VKEY_C, false, true, false);
return true;
case IDS_APP_PASTE:
- *accelerator = views::Accelerator(app::VKEY_V, false, true, false);
+ *accelerator = views::Accelerator(ui::VKEY_V, false, true, false);
return true;
}
return container_view_->GetWidget()->GetAccelerator(command_id, accelerator);
@@ -915,7 +915,7 @@ void NativeTextfieldWin::HandleKeystroke(UINT message,
type = Event::ET_KEY_PRESSED;
}
KeyEvent key_event(type,
- app::KeyboardCodeForWindowsKeyCode(key),
+ ui::KeyboardCodeForWindowsKeyCode(key),
KeyEvent::GetKeyStateFlags(),
repeat_count,
flags,
@@ -926,7 +926,7 @@ void NativeTextfieldWin::HandleKeystroke(UINT message,
if (!handled) {
OnBeforePossibleChange();
- if (key == app::VKEY_HOME || key == app::VKEY_END) {
+ if (key == ui::VKEY_HOME || key == ui::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 53d3695..66f7489 100644
--- a/views/controls/textfield/textfield.cc
+++ b/views/controls/textfield/textfield.cc
@@ -10,16 +10,16 @@
#include <string>
-#include "app/keyboard_codes.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "gfx/insets.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/native/native_view_host.h"
#include "views/controls/textfield/native_textfield_wrapper.h"
#include "views/widget/widget.h"
#if defined(OS_LINUX)
-#include "app/keyboard_code_conversion_gtk.h"
+#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
#elif defined(OS_WIN)
#include "app/win/win_util.h"
#include "base/win/win_util.h"
@@ -272,14 +272,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.
- app::KeyboardCode key = e.GetKeyCode();
- if (key == app::VKEY_BACK)
+ ui::KeyboardCode key = e.GetKeyCode();
+ if (key == ui::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 != app::VKEY_HOME) &&
+ if (e.IsAltDown() && (key != ui::VKEY_HOME) &&
app::win::IsNumPadDigit(key, e.IsExtendedKey()))
return true;
#endif
diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h
index fd9174e..afcc441 100644
--- a/views/controls/textfield/textfield.h
+++ b/views/controls/textfield/textfield.h
@@ -14,16 +14,16 @@
#include <string>
-#include "app/keyboard_codes.h"
#include "base/basictypes.h"
-#if !defined(OS_LINUX)
-#include "base/logging.h"
-#endif
#include "base/string16.h"
#include "gfx/font.h"
-#include "views/view.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+#include "views/view.h"
+#if !defined(OS_LINUX)
+#include "base/logging.h"
+#endif
#ifdef UNIT_TEST
#include "gfx/native_widget_types.h"
#include "views/controls/textfield/native_textfield_wrapper.h"
diff --git a/views/controls/tree/tree_view.cc b/views/controls/tree/tree_view.cc
index 746330d..b45ff45 100644
--- a/views/controls/tree/tree_view.cc
+++ b/views/controls/tree/tree_view.cc
@@ -6,8 +6,6 @@
#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 "app/win/hwnd_util.h"
@@ -21,6 +19,8 @@
#include "gfx/icon_util.h"
#include "gfx/point.h"
#include "grit/app_resources.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/base/keycodes/keyboard_code_conversion_win.h"
#include "views/focus/focus_manager.h"
#include "views/widget/widget.h"
@@ -441,7 +441,7 @@ LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) {
NMTVKEYDOWN* key_down_message =
reinterpret_cast<NMTVKEYDOWN*>(l_param);
controller_->OnTreeViewKeyDown(
- app::KeyboardCodeForWindowsKeyCode(key_down_message->wVKey));
+ ui::KeyboardCodeForWindowsKeyCode(key_down_message->wVKey));
}
break;
@@ -451,7 +451,7 @@ LRESULT TreeView::OnNotify(int w_param, LPNMHDR l_param) {
return 0;
}
-bool TreeView::OnKeyDown(app::KeyboardCode virtual_key_code) {
+bool TreeView::OnKeyDown(ui::KeyboardCode virtual_key_code) {
if (virtual_key_code == VK_F2) {
if (!GetEditingNode()) {
TreeModelNode* selected_node = GetSelectedNode();
@@ -459,7 +459,7 @@ bool TreeView::OnKeyDown(app::KeyboardCode virtual_key_code) {
StartEditing(selected_node);
}
return true;
- } else if (virtual_key_code == app::VKEY_RETURN && !process_enter_) {
+ } else if (virtual_key_code == ui::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 61c6001..463a8bc 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 "ui/base/keycodes/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(app::KeyboardCode keycode) {}
+ virtual void OnTreeViewKeyDown(ui::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(app::KeyboardCode virtual_key_code);
+ virtual bool OnKeyDown(ui::KeyboardCode virtual_key_code);
virtual void OnContextMenu(const POINT& location);
diff --git a/views/event.cc b/views/event.cc
index e047004..7584a4d 100644
--- a/views/event.cc
+++ b/views/event.cc
@@ -25,7 +25,7 @@ LocatedEvent::LocatedEvent(const LocatedEvent& model, View* from, View* to)
View::ConvertPointToView(from, to, &location_);
}
-KeyEvent::KeyEvent(EventType type, app::KeyboardCode key_code,
+KeyEvent::KeyEvent(EventType type, ui::KeyboardCode key_code,
int event_flags, int repeat_count, int message_flags)
: Event(type, event_flags),
key_code_(key_code),
diff --git a/views/event.h b/views/event.h
index b1760b9..4dd1ed1 100644
--- a/views/event.h
+++ b/views/event.h
@@ -6,9 +6,9 @@
#define VIEWS_EVENT_H_
#pragma once
-#include "app/keyboard_codes.h"
#include "base/basictypes.h"
#include "gfx/point.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#if defined(OS_LINUX)
typedef struct _GdkEventKey GdkEventKey;
@@ -331,14 +331,14 @@ class KeyEvent : public Event {
public:
// Create a new key event
KeyEvent(EventType type,
- app::KeyboardCode key_code,
+ ui::KeyboardCode key_code,
int event_flags,
int repeat_count,
int message_flags);
#if defined(OS_WIN)
KeyEvent(EventType type,
- app::KeyboardCode key_code,
+ ui::KeyboardCode key_code,
int event_flags,
int repeat_count,
int message_flags,
@@ -358,7 +358,7 @@ class KeyEvent : public Event {
// the Windows value.
// On GTK, you can use the methods in keyboard_code_conversion_gtk.cc to
// convert this value back to a GDK value if needed.
- app::KeyboardCode GetKeyCode() const {
+ ui::KeyboardCode GetKeyCode() const {
return key_code_;
}
@@ -380,7 +380,7 @@ class KeyEvent : public Event {
private:
- app::KeyboardCode key_code_;
+ ui::KeyboardCode key_code_;
int repeat_count_;
int message_flags_;
#if defined(OS_WIN)
diff --git a/views/event_gtk.cc b/views/event_gtk.cc
index 5e29ad9..5b3cf21 100644
--- a/views/event_gtk.cc
+++ b/views/event_gtk.cc
@@ -6,7 +6,7 @@
#include <gdk/gdk.h>
-#include "app/keyboard_code_conversion_gtk.h"
+#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
namespace views {
@@ -15,7 +15,7 @@ KeyEvent::KeyEvent(const GdkEventKey* event)
Event::ET_KEY_PRESSED : Event::ET_KEY_RELEASED,
GetFlagsFromGdkState(event->state)),
// TODO(erg): All these values are iffy.
- key_code_(app::WindowsKeyCodeForGdkKeyCode(event->keyval)),
+ key_code_(ui::WindowsKeyCodeForGdkKeyCode(event->keyval)),
repeat_count_(0),
message_flags_(0)
#if !defined(TOUCH_UI)
diff --git a/views/event_win.cc b/views/event_win.cc
index 99f43a0..00d7c9b 100644
--- a/views/event_win.cc
+++ b/views/event_win.cc
@@ -8,7 +8,7 @@
namespace views {
-KeyEvent::KeyEvent(EventType type, app::KeyboardCode key_code,
+KeyEvent::KeyEvent(EventType type, ui::KeyboardCode key_code,
int event_flags, int repeat_count, int message_flags,
UINT message)
: Event(type, event_flags),
diff --git a/views/event_x.cc b/views/event_x.cc
index bddeb71..c9ead16 100644
--- a/views/event_x.cc
+++ b/views/event_x.cc
@@ -9,7 +9,7 @@
#include <X11/extensions/XInput2.h>
#endif
-#include "app/keyboard_code_conversion_x.h"
+#include "ui/base/keycodes/keyboard_code_conversion_x.h"
#include "views/widget/root_view.h"
#include "views/widget/widget_gtk.h"
@@ -203,7 +203,7 @@ KeyEvent::KeyEvent(XEvent* xev)
: Event(xev->type == KeyPress ?
Event::ET_KEY_PRESSED : Event::ET_KEY_RELEASED,
GetEventFlagsFromXState(xev->xkey.state)),
- key_code_(app::KeyboardCodeFromXKeyEvent(xev)),
+ key_code_(ui::KeyboardCodeFromXKeyEvent(xev)),
repeat_count_(0),
message_flags_(0),
native_event_(NULL) {
diff --git a/views/examples/table2_example.h b/views/examples/table2_example.h
index ed03e87..a3504e1 100644
--- a/views/examples/table2_example.h
+++ b/views/examples/table2_example.h
@@ -135,7 +135,7 @@ class Table2Example
virtual void OnMiddleClick() {}
- virtual void OnKeyDown(app::KeyboardCode virtual_keycode) {}
+ virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) {}
virtual void OnTableViewDelete(views::TableView* table_view) {}
diff --git a/views/examples/table_example.h b/views/examples/table_example.h
index c71b2c8..8c2a36e 100644
--- a/views/examples/table_example.h
+++ b/views/examples/table_example.h
@@ -124,7 +124,7 @@ class TableExample
virtual void OnMiddleClick() {}
- virtual void OnKeyDown(app::KeyboardCode virtual_keycode) {}
+ virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) {}
virtual void OnTableViewDelete(views::TableView* table_view) {}
diff --git a/views/focus/accelerator_handler_gtk_unittest.cc b/views/focus/accelerator_handler_gtk_unittest.cc
index baa11bc..2fc93be 100644
--- a/views/focus/accelerator_handler_gtk_unittest.cc
+++ b/views/focus/accelerator_handler_gtk_unittest.cc
@@ -19,8 +19,8 @@ class AcceleratorHandlerGtkTest
public AcceleratorTarget {
public:
AcceleratorHandlerGtkTest()
- : kMenuAccelerator(app::VKEY_MENU, false, false, false),
- kHomepageAccelerator(app::VKEY_HOME, false, false, true),
+ : kMenuAccelerator(ui::VKEY_MENU, false, false, false),
+ kHomepageAccelerator(ui::VKEY_HOME, false, false, true),
content_view_(NULL) {
}
diff --git a/views/focus/accelerator_handler_win.cc b/views/focus/accelerator_handler_win.cc
index 6e50800..c741155 100644
--- a/views/focus/accelerator_handler_win.cc
+++ b/views/focus/accelerator_handler_win.cc
@@ -4,8 +4,8 @@
#include "views/focus/accelerator_handler.h"
-#include "app/keyboard_code_conversion_win.h"
-#include "app/keyboard_codes.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+#include "ui/base/keycodes/keyboard_code_conversion_win.h"
#include "views/event.h"
#include "views/focus/focus_manager.h"
@@ -25,7 +25,7 @@ bool AcceleratorHandler::Dispatch(const MSG& msg) {
case WM_KEYDOWN:
case WM_SYSKEYDOWN: {
KeyEvent event(Event::ET_KEY_PRESSED,
- app::KeyboardCodeForWindowsKeyCode(msg.wParam),
+ ui::KeyboardCodeForWindowsKeyCode(msg.wParam),
KeyEvent::GetKeyStateFlags(),
msg.lParam & 0xFFFF,
(msg.lParam & 0xFFFF0000) >> 16);
diff --git a/views/focus/focus_manager.cc b/views/focus/focus_manager.cc
index 50becdd..faaf4c5 100644
--- a/views/focus/focus_manager.cc
+++ b/views/focus/focus_manager.cc
@@ -12,8 +12,8 @@
#include <gtk/gtk.h>
#endif
-#include "app/keyboard_codes.h"
#include "base/logging.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/accelerator.h"
#include "views/focus/focus_search.h"
#include "views/focus/view_storage.h"
@@ -120,11 +120,11 @@ bool FocusManager::OnKeyEvent(const KeyEvent& event) {
#endif
// Intercept arrow key messages to switch between grouped views.
- app::KeyboardCode key_code = event.GetKeyCode();
+ ui::KeyboardCode key_code = event.GetKeyCode();
if (focused_view_ && focused_view_->GetGroup() != -1 &&
- (key_code == app::VKEY_UP || key_code == app::VKEY_DOWN ||
- key_code == app::VKEY_LEFT || key_code == app::VKEY_RIGHT)) {
- bool next = (key_code == app::VKEY_RIGHT || key_code == app::VKEY_DOWN);
+ (key_code == ui::VKEY_UP || key_code == ui::VKEY_DOWN ||
+ key_code == ui::VKEY_LEFT || key_code == ui::VKEY_RIGHT)) {
+ bool next = (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN);
std::vector<View*> views;
focused_view_->GetParent()->GetViewsWithGroup(focused_view_->GetGroup(),
&views);
@@ -509,7 +509,7 @@ AcceleratorTarget* FocusManager::GetCurrentTargetForAccelerator(
// static
bool FocusManager::IsTabTraversalKeyEvent(const KeyEvent& key_event) {
- return key_event.GetKeyCode() == app::VKEY_TAB &&
+ return key_event.GetKeyCode() == ui::VKEY_TAB &&
!key_event.IsControlDown();
}
diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc
index c7a3cf4..716f4d1 100644
--- a/views/focus/focus_manager_unittest.cc
+++ b/views/focus/focus_manager_unittest.cc
@@ -5,13 +5,13 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "app/combobox_model.h"
-#include "app/keyboard_codes.h"
#include "base/logging.h"
#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "gfx/rect.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/background.h"
#include "views/border.h"
#include "views/controls/button/checkbox.h"
@@ -36,7 +36,7 @@
#include "views/widget/widget_win.h"
#include "views/window/window_win.h"
#elif defined(OS_LINUX)
-#include "app/keyboard_code_conversion_gtk.h"
+#include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
#include "views/window/window_gtk.h"
#endif
@@ -209,23 +209,23 @@ class FocusManagerTest : public testing::Test, public WindowDelegate {
}
#if defined(OS_WIN)
- void PostKeyDown(app::KeyboardCode key_code) {
+ void PostKeyDown(ui::KeyboardCode key_code) {
::PostMessage(window_->GetNativeWindow(), WM_KEYDOWN, key_code, 0);
}
- void PostKeyUp(app::KeyboardCode key_code) {
+ void PostKeyUp(ui::KeyboardCode key_code) {
::PostMessage(window_->GetNativeWindow(), WM_KEYUP, key_code, 0);
}
#elif defined(OS_LINUX)
- void PostKeyDown(app::KeyboardCode key_code) {
+ void PostKeyDown(ui::KeyboardCode key_code) {
PostKeyEvent(key_code, true);
}
- void PostKeyUp(app::KeyboardCode key_code) {
+ void PostKeyUp(ui::KeyboardCode key_code) {
PostKeyEvent(key_code, false);
}
- void PostKeyEvent(app::KeyboardCode key_code, bool pressed) {
+ void PostKeyEvent(ui::KeyboardCode key_code, bool pressed) {
int keyval = GdkKeyCodeForWindowsKeyCode(key_code, false);
GdkKeymapKey* keys;
gint n_keys;
@@ -1300,8 +1300,8 @@ class TestAcceleratorTarget : public AcceleratorTarget {
TEST_F(FocusManagerTest, CallsNormalAcceleratorTarget) {
FocusManager* focus_manager = GetFocusManager();
- Accelerator return_accelerator(app::VKEY_RETURN, false, false, false);
- Accelerator escape_accelerator(app::VKEY_ESCAPE, false, false, false);
+ Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false);
+ Accelerator escape_accelerator(ui::VKEY_ESCAPE, false, false, false);
TestAcceleratorTarget return_target(true);
TestAcceleratorTarget escape_target(true);
@@ -1418,7 +1418,7 @@ class SelfUnregisteringAcceleratorTarget : public AcceleratorTarget {
TEST_F(FocusManagerTest, CallsSelfDeletingAcceleratorTarget) {
FocusManager* focus_manager = GetFocusManager();
- Accelerator return_accelerator(app::VKEY_RETURN, false, false, false);
+ Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false);
SelfUnregisteringAcceleratorTarget target(return_accelerator, focus_manager);
EXPECT_EQ(target.accelerator_count(), 0);
EXPECT_EQ(NULL,
@@ -1466,11 +1466,11 @@ class MessageTrackingView : public View {
keys_released_.clear();
}
- const std::vector<app::KeyboardCode>& keys_pressed() const {
+ const std::vector<ui::KeyboardCode>& keys_pressed() const {
return keys_pressed_;
}
- const std::vector<app::KeyboardCode>& keys_released() const {
+ const std::vector<ui::KeyboardCode>& keys_released() const {
return keys_released_;
}
@@ -1480,8 +1480,8 @@ class MessageTrackingView : public View {
private:
bool accelerator_pressed_;
- std::vector<app::KeyboardCode> keys_pressed_;
- std::vector<app::KeyboardCode> keys_released_;
+ std::vector<ui::KeyboardCode> keys_pressed_;
+ std::vector<ui::KeyboardCode> keys_released_;
DISALLOW_COPY_AND_ASSIGN(MessageTrackingView);
};
@@ -1494,53 +1494,53 @@ class MessageTrackingView : public View {
TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) {
FocusManager* focus_manager = GetFocusManager();
MessageTrackingView* mtv = new MessageTrackingView();
- mtv->AddAccelerator(Accelerator(app::VKEY_0, false, false, false));
- mtv->AddAccelerator(Accelerator(app::VKEY_1, false, false, false));
+ mtv->AddAccelerator(Accelerator(ui::VKEY_0, false, false, false));
+ mtv->AddAccelerator(Accelerator(ui::VKEY_1, false, false, false));
content_view_->AddChildView(mtv);
focus_manager->SetFocusedView(mtv);
// First send a non-accelerator key sequence.
- PostKeyDown(app::VKEY_9);
- PostKeyUp(app::VKEY_9);
+ PostKeyDown(ui::VKEY_9);
+ PostKeyUp(ui::VKEY_9);
AcceleratorHandler accelerator_handler;
MessageLoopForUI::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
MessageLoopForUI::current()->Run(&accelerator_handler);
// Make sure we get a key-up and key-down.
ASSERT_EQ(1U, mtv->keys_pressed().size());
- EXPECT_EQ(app::VKEY_9, mtv->keys_pressed().at(0));
+ EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed().at(0));
ASSERT_EQ(1U, mtv->keys_released().size());
- EXPECT_EQ(app::VKEY_9, mtv->keys_released().at(0));
+ EXPECT_EQ(ui::VKEY_9, mtv->keys_released().at(0));
EXPECT_FALSE(mtv->accelerator_pressed());
mtv->Reset();
// Same thing with repeat and more than one key at once.
- PostKeyDown(app::VKEY_9);
- PostKeyDown(app::VKEY_9);
- PostKeyDown(app::VKEY_8);
- PostKeyDown(app::VKEY_9);
- PostKeyDown(app::VKEY_7);
- PostKeyUp(app::VKEY_9);
- PostKeyUp(app::VKEY_7);
- PostKeyUp(app::VKEY_8);
+ PostKeyDown(ui::VKEY_9);
+ PostKeyDown(ui::VKEY_9);
+ PostKeyDown(ui::VKEY_8);
+ PostKeyDown(ui::VKEY_9);
+ PostKeyDown(ui::VKEY_7);
+ PostKeyUp(ui::VKEY_9);
+ PostKeyUp(ui::VKEY_7);
+ PostKeyUp(ui::VKEY_8);
MessageLoopForUI::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
MessageLoopForUI::current()->Run(&accelerator_handler);
// Make sure we get a key-up and key-down.
ASSERT_EQ(5U, mtv->keys_pressed().size());
- EXPECT_EQ(app::VKEY_9, mtv->keys_pressed().at(0));
- EXPECT_EQ(app::VKEY_9, mtv->keys_pressed().at(1));
- EXPECT_EQ(app::VKEY_8, mtv->keys_pressed().at(2));
- EXPECT_EQ(app::VKEY_9, mtv->keys_pressed().at(3));
- EXPECT_EQ(app::VKEY_7, mtv->keys_pressed().at(4));
+ EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed().at(0));
+ EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed().at(1));
+ EXPECT_EQ(ui::VKEY_8, mtv->keys_pressed().at(2));
+ EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed().at(3));
+ EXPECT_EQ(ui::VKEY_7, mtv->keys_pressed().at(4));
ASSERT_EQ(3U, mtv->keys_released().size());
- EXPECT_EQ(app::VKEY_9, mtv->keys_released().at(0));
- EXPECT_EQ(app::VKEY_7, mtv->keys_released().at(1));
- EXPECT_EQ(app::VKEY_8, mtv->keys_released().at(2));
+ EXPECT_EQ(ui::VKEY_9, mtv->keys_released().at(0));
+ EXPECT_EQ(ui::VKEY_7, mtv->keys_released().at(1));
+ EXPECT_EQ(ui::VKEY_8, mtv->keys_released().at(2));
EXPECT_FALSE(mtv->accelerator_pressed());
mtv->Reset();
// Now send an accelerator key sequence.
- PostKeyDown(app::VKEY_0);
- PostKeyUp(app::VKEY_0);
+ PostKeyDown(ui::VKEY_0);
+ PostKeyUp(ui::VKEY_0);
MessageLoopForUI::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
MessageLoopForUI::current()->Run(&accelerator_handler);
EXPECT_TRUE(mtv->keys_pressed().empty());
@@ -1549,13 +1549,13 @@ TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) {
mtv->Reset();
// Same thing with repeat and more than one key at once.
- PostKeyDown(app::VKEY_0);
- PostKeyDown(app::VKEY_1);
- PostKeyDown(app::VKEY_1);
- PostKeyDown(app::VKEY_0);
- PostKeyDown(app::VKEY_0);
- PostKeyUp(app::VKEY_1);
- PostKeyUp(app::VKEY_0);
+ PostKeyDown(ui::VKEY_0);
+ PostKeyDown(ui::VKEY_1);
+ PostKeyDown(ui::VKEY_1);
+ PostKeyDown(ui::VKEY_0);
+ PostKeyDown(ui::VKEY_0);
+ PostKeyUp(ui::VKEY_1);
+ PostKeyUp(ui::VKEY_0);
MessageLoopForUI::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
MessageLoopForUI::current()->Run(&accelerator_handler);
EXPECT_TRUE(mtv->keys_pressed().empty());
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index 0bd612f..eb0ec47 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -4,12 +4,12 @@
#include <map>
-#include "app/keyboard_codes.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "gfx/canvas_skia.h"
#include "gfx/path.h"
#include "ui/base/clipboard/clipboard.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/background.h"
#include "views/controls/button/checkbox.h"
#include "views/controls/native/native_view_host.h"
@@ -950,7 +950,7 @@ bool TestView::AcceleratorPressed(const Accelerator& accelerator) {
#if defined(OS_WIN)
TEST_F(ViewTest, ActivateAccelerator) {
// Register a keyboard accelerator before the view is added to a window.
- views::Accelerator return_accelerator(app::VKEY_RETURN, false, false, false);
+ views::Accelerator return_accelerator(ui::VKEY_RETURN, false, false, false);
TestView* view = new TestView();
view->Reset();
view->AddAccelerator(return_accelerator);
@@ -974,7 +974,7 @@ TEST_F(ViewTest, ActivateAccelerator) {
EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1);
// Hit the escape key. Nothing should happen.
- views::Accelerator escape_accelerator(app::VKEY_ESCAPE, false, false, false);
+ views::Accelerator escape_accelerator(ui::VKEY_ESCAPE, false, false, false);
EXPECT_FALSE(focus_manager->ProcessAccelerator(escape_accelerator));
EXPECT_EQ(view->accelerator_count_map_[return_accelerator], 1);
EXPECT_EQ(view->accelerator_count_map_[escape_accelerator], 0);
@@ -1230,7 +1230,7 @@ class DefaultButtonTest : public ViewTest {
}
void SimularePressingEnterAndCheckDefaultButton(ButtonID button_id) {
- KeyEvent event(Event::ET_KEY_PRESSED, app::VKEY_RETURN, 0, 0, 0);
+ KeyEvent event(Event::ET_KEY_PRESSED, ui::VKEY_RETURN, 0, 0, 0);
focus_manager_->OnKeyEvent(event);
switch (button_id) {
case OK:
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index 82f32ba..143b23a 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -7,10 +7,10 @@
#include <algorithm>
#include "app/drag_drop_types.h"
-#include "app/keyboard_codes.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "gfx/canvas_skia.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/fill_layout.h"
#include "views/focus/view_storage.h"
#include "views/widget/widget.h"
@@ -661,8 +661,8 @@ bool RootView::ProcessKeyEvent(const KeyEvent& event) {
View* v = GetFocusedView();
// Special case to handle right-click context menus triggered by the
// keyboard.
- if (v && v->IsEnabled() && ((event.GetKeyCode() == app::VKEY_APPS) ||
- (event.GetKeyCode() == app::VKEY_F10 && event.IsShiftDown()))) {
+ if (v && v->IsEnabled() && ((event.GetKeyCode() == ui::VKEY_APPS) ||
+ (event.GetKeyCode() == ui::VKEY_F10 && event.IsShiftDown()))) {
v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false);
return true;
}
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 6eb3706..cf12551 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -889,21 +889,21 @@ bool WidgetGtk::HandleKeyboardEvent(GdkEventKey* event) {
// VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only
// be activated when handling a VKEY_MENU key release event which is preceded
// by an unhandled VKEY_MENU key press event.
- if (key_code != app::VKEY_MENU || event->type != GDK_KEY_RELEASE)
+ if (key_code != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE)
should_handle_menu_key_release_ = false;
if (event->type == GDK_KEY_PRESS) {
// VKEY_MENU is triggered by key release event.
// FocusManager::OnKeyEvent() returns false when the key has been consumed.
- if (key_code != app::VKEY_MENU)
+ if (key_code != ui::VKEY_MENU)
handled = !focus_manager_->OnKeyEvent(key);
else
should_handle_menu_key_release_ = true;
- } else if (key_code == app::VKEY_MENU && should_handle_menu_key_release_ &&
+ } else if (key_code == ui::VKEY_MENU && should_handle_menu_key_release_ &&
(key.GetFlags() & ~Event::EF_ALT_DOWN) == 0) {
// Trigger VKEY_MENU when only this key is pressed and released, and both
// press and release events are not handled by others.
- Accelerator accelerator(app::VKEY_MENU, false, false, false);
+ Accelerator accelerator(ui::VKEY_MENU, false, false, false);
handled = focus_manager_->ProcessAccelerator(accelerator);
}
@@ -1173,7 +1173,7 @@ gboolean WidgetGtk::OnKeyEvent(GtkWidget* widget, GdkEventKey* event) {
// VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only
// be activated when handling a VKEY_MENU key release event which is preceded
// by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent().
- if (key.GetKeyCode() != app::VKEY_MENU || event->type != GDK_KEY_RELEASE)
+ if (key.GetKeyCode() != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE)
should_handle_menu_key_release_ = false;
bool handled = false;
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index 5aef351..4f9eb54 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -4,7 +4,6 @@
#include "views/widget/widget_win.h"
-#include "app/keyboard_code_conversion_win.h"
#include "app/l10n_util_win.h"
#include "app/system_monitor.h"
#include "app/view_prop.h"
@@ -14,6 +13,7 @@
#include "gfx/canvas_skia.h"
#include "gfx/native_theme_win.h"
#include "gfx/path.h"
+#include "ui/base/keycodes/keyboard_code_conversion_win.h"
#include "views/accessibility/view_accessibility.h"
#include "views/controls/native_control_win.h"
#include "views/focus/focus_util_win.h"
@@ -661,7 +661,7 @@ void WidgetWin::OnInitMenuPopup(HMENU menu,
}
void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) {
- KeyEvent event(Event::ET_KEY_PRESSED, app::KeyboardCodeForWindowsKeyCode(c),
+ KeyEvent event(Event::ET_KEY_PRESSED, ui::KeyboardCodeForWindowsKeyCode(c),
KeyEvent::GetKeyStateFlags(), rep_cnt, flags,
WM_KEYDOWN);
RootView* root_view = GetFocusedViewRootView();
@@ -672,7 +672,7 @@ void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) {
}
void WidgetWin::OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags) {
- KeyEvent event(Event::ET_KEY_RELEASED, app::KeyboardCodeForWindowsKeyCode(c),
+ KeyEvent event(Event::ET_KEY_RELEASED, ui::KeyboardCodeForWindowsKeyCode(c),
KeyEvent::GetKeyStateFlags(), rep_cnt, flags,
WM_KEYUP);
RootView* root_view = GetFocusedViewRootView();
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc
index ad89187..1eda791 100644
--- a/views/window/dialog_client_view.cc
+++ b/views/window/dialog_client_view.cc
@@ -14,13 +14,13 @@
#include <algorithm>
-#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/utf_string_conversions.h"
#include "gfx/canvas_skia.h"
#include "gfx/font.h"
#include "grit/app_strings.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "views/controls/button/native_button.h"
#include "views/standard_layout.h"
#include "views/window/dialog_delegate.h"
@@ -140,7 +140,7 @@ void DialogClientView::ShowDialogButtons() {
if (is_default_button)
default_button_ = ok_button_;
if (!(buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL))
- ok_button_->AddAccelerator(Accelerator(app::VKEY_ESCAPE,
+ ok_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE,
false, false, false));
AddChildView(ok_button_);
}
@@ -161,7 +161,7 @@ void DialogClientView::ShowDialogButtons() {
MessageBoxFlags::DIALOGBUTTON_CANCEL,
label, is_default_button);
cancel_button_->SetGroup(kButtonGroup);
- cancel_button_->AddAccelerator(Accelerator(app::VKEY_ESCAPE,
+ cancel_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE,
false, false, false));
if (is_default_button)
default_button_ = ok_button_;
@@ -170,7 +170,7 @@ void DialogClientView::ShowDialogButtons() {
if (!buttons) {
// Register the escape key as an accelerator which will close the window
// if there are no dialog buttons.
- AddAccelerator(Accelerator(app::VKEY_ESCAPE, false, false, false));
+ AddAccelerator(Accelerator(ui::VKEY_ESCAPE, false, false, false));
}
}
@@ -388,7 +388,7 @@ gfx::Size DialogClientView::GetPreferredSize() {
bool DialogClientView::AcceleratorPressed(const Accelerator& accelerator) {
// We only expect Escape key.
- DCHECK(accelerator.GetKeyCode() == app::VKEY_ESCAPE);
+ DCHECK(accelerator.GetKeyCode() == ui::VKEY_ESCAPE);
Close();
return true;
}
diff --git a/views/window/window_win.cc b/views/window/window_win.cc
index c0f4523..5a424c3 100644
--- a/views/window/window_win.cc
+++ b/views/window/window_win.cc
@@ -7,7 +7,6 @@
#include <dwmapi.h>
#include <shellapi.h>
-#include "app/keyboard_code_conversion_win.h"
#include "app/theme_provider.h"
#include "app/win/hwnd_util.h"
#include "app/win/win_util.h"
@@ -17,6 +16,7 @@
#include "gfx/font.h"
#include "gfx/icon_util.h"
#include "gfx/path.h"
+#include "ui/base/keycodes/keyboard_code_conversion_win.h"
#include "views/accessibility/view_accessibility.h"
#include "views/widget/root_view.h"
#include "views/window/client_view.h"
@@ -1175,7 +1175,7 @@ void WindowWin::OnSysCommand(UINT notification_code, CPoint click) {
if ((notification_code & sc_mask) == SC_KEYMENU && click.x == 0) {
// Retrieve the status of shift and control keys to prevent consuming
// shift+alt keys, which are used by Windows to change input languages.
- Accelerator accelerator(app::KeyboardCodeForWindowsKeyCode(VK_MENU),
+ Accelerator accelerator(ui::KeyboardCodeForWindowsKeyCode(VK_MENU),
!!(GetKeyState(VK_SHIFT) & 0x8000),
!!(GetKeyState(VK_CONTROL) & 0x8000),
false);