summaryrefslogtreecommitdiffstats
path: root/views/focus
diff options
context:
space:
mode:
Diffstat (limited to 'views/focus')
-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
4 files changed, 56 insertions, 56 deletions
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());