diff options
158 files changed, 1246 insertions, 1268 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi index 2614bb4..ed52efc 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -121,6 +121,19 @@ '../ui/base/dragdrop/os_exchange_data_provider_win.h', '../ui/base/dragdrop/os_exchange_data.cc', '../ui/base/dragdrop/os_exchange_data.h', + '../ui/base/keycodes/keyboard_code_conversion.cc', + '../ui/base/keycodes/keyboard_code_conversion.h', + '../ui/base/keycodes/keyboard_code_conversion_gtk.cc', + '../ui/base/keycodes/keyboard_code_conversion_gtk.h', + '../ui/base/keycodes/keyboard_code_conversion_mac.mm', + '../ui/base/keycodes/keyboard_code_conversion_mac.h', + '../ui/base/keycodes/keyboard_code_conversion_win.cc', + '../ui/base/keycodes/keyboard_code_conversion_win.h', + '../ui/base/keycodes/keyboard_code_conversion_x.cc', + '../ui/base/keycodes/keyboard_code_conversion_x.h', + '../ui/base/keycodes/keyboard_codes.h', + '../ui/base/keycodes/keyboard_codes_win.h', + '../ui/base/keycodes/keyboard_codes_posix.h', 'active_window_watcher_x.cc', 'active_window_watcher_x.h', 'bidi_line_iterator.cc', @@ -157,19 +170,6 @@ 'gtk_signal.h', 'gtk_signal_registrar.cc', 'gtk_signal_registrar.h', - 'keyboard_code_conversion.cc', - 'keyboard_code_conversion.h', - 'keyboard_code_conversion_gtk.cc', - 'keyboard_code_conversion_gtk.h', - 'keyboard_code_conversion_mac.mm', - 'keyboard_code_conversion_mac.h', - 'keyboard_code_conversion_win.cc', - 'keyboard_code_conversion_win.h', - 'keyboard_code_conversion_x.cc', - 'keyboard_code_conversion_x.h', - 'keyboard_codes.h', - 'keyboard_codes_win.h', - 'keyboard_codes_posix.h', 'l10n_util.cc', 'l10n_util.h', 'l10n_util_collator.h', @@ -347,9 +347,9 @@ '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h', ], 'sources!': [ - 'keyboard_code_conversion_mac.mm', - 'keyboard_code_conversion_mac.h', - 'keyboard_codes_win.h', + '../ui/base/keycodes/keyboard_code_conversion_mac.mm', + '../ui/base/keycodes/keyboard_code_conversion_mac.h', + '../ui/base/keycodes/keyboard_codes_win.h', ], 'include_dirs': [ # We don't use angle, but pull the EGL/GLES headers from there. @@ -377,13 +377,13 @@ ], }, 'sources!': [ + '../ui/base/keycodes/keyboard_code_conversion_gtk.cc', + '../ui/base/keycodes/keyboard_code_conversion_gtk.h', + '../ui/base/keycodes/keyboard_code_conversion_x.cc', + '../ui/base/keycodes/keyboard_code_conversion_x.h', + '../ui/base/keycodes/keyboard_codes_win.h', 'event_synthesis_gtk.cc', 'event_synthesis_gtk.h', - 'keyboard_code_conversion_gtk.cc', - 'keyboard_code_conversion_gtk.h', - 'keyboard_code_conversion_x.cc', - 'keyboard_code_conversion_x.h', - 'keyboard_codes_win.h', ], }], ['OS=="win"', { @@ -399,15 +399,15 @@ '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h', ], 'sources!': [ + '../ui/base/keycodes/keyboard_code_conversion_gtk.cc', + '../ui/base/keycodes/keyboard_code_conversion_gtk.h', + '../ui/base/keycodes/keyboard_code_conversion_mac.mm', + '../ui/base/keycodes/keyboard_code_conversion_mac.h', + '../ui/base/keycodes/keyboard_code_conversion_x.cc', + '../ui/base/keycodes/keyboard_code_conversion_x.h', + '../ui/base/keycodes/keyboard_codes_posix.h', 'event_synthesis_gtk.cc', 'event_synthesis_gtk.h', - 'keyboard_code_conversion_gtk.cc', - 'keyboard_code_conversion_gtk.h', - 'keyboard_code_conversion_mac.mm', - 'keyboard_code_conversion_mac.h', - 'keyboard_code_conversion_x.cc', - 'keyboard_code_conversion_x.h', - 'keyboard_codes_posix.h', ], }], ], diff --git a/app/event_synthesis_gtk.cc b/app/event_synthesis_gtk.cc index 9163fcc..72dd7b9 100644 --- a/app/event_synthesis_gtk.cc +++ b/app/event_synthesis_gtk.cc @@ -4,7 +4,7 @@ #include "app/event_synthesis_gtk.h" -#include "app/keyboard_code_conversion_gtk.h" +#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" namespace app { @@ -39,7 +39,7 @@ GdkEvent* SynthesizeKeyEvent(GdkWindow* window, } void SynthesizeKeyPressEvents(GdkWindow* window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, std::vector<GdkEvent*>* events) { if (control) diff --git a/app/event_synthesis_gtk.h b/app/event_synthesis_gtk.h index 72d8279..3ee1cb3 100644 --- a/app/event_synthesis_gtk.h +++ b/app/event_synthesis_gtk.h @@ -14,7 +14,7 @@ #include <gdk/gdkkeysyms.h> #include <vector> -#include "app/keyboard_codes.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace app { @@ -28,7 +28,7 @@ GdkEvent* SynthesizeKeyEvent(GdkWindow* event_window, // Ownership of the events in the vector is passed to the caller. void SynthesizeKeyPressEvents( GdkWindow* window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, std::vector<GdkEvent*>* events); diff --git a/app/keyboard_code_conversion_unittest.cc b/app/keyboard_code_conversion_unittest.cc deleted file mode 100644 index 0f8d6af..0000000 --- a/app/keyboard_code_conversion_unittest.cc +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "app/keyboard_code_conversion.h" -#include "app/keyboard_codes.h" -#include "base/logging.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace app { - -TEST(KeyCodeFromKeyIdentifierTest, MatchOnIdentifier) { - EXPECT_EQ(app::VKEY_APPS, KeyCodeFromKeyIdentifier("Apps")); - EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("Nonsense")); -} - -TEST(KeyCodeFromKeyIdentifierTest, MatchOnCharacter) { - EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("a")); - EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("A")); - EXPECT_EQ(app::VKEY_OEM_PERIOD, KeyCodeFromKeyIdentifier(">")); - - std::string non_printing_char(" "); - non_printing_char[0] = static_cast<char>(1); - EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier(non_printing_char)); -} - -TEST(KeyCodeFromKeyIdentifierTest, MatchOnUnicodeCodepoint) { - EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("U+0041")); - EXPECT_EQ(app::VKEY_A, KeyCodeFromKeyIdentifier("U+0061")); - EXPECT_EQ(app::VKEY_DELETE, KeyCodeFromKeyIdentifier("U+007F")); - - // this one exists in the map, but has no valid VKEY - EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+030A")); - - // this one is not in the map - EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+0001")); -} - -TEST(KeyCodeFromKeyIdentifierTest, DoesNotMatchEmptyString) { - EXPECT_EQ(app::VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("")); -} - -} // namespace app diff --git a/app/keyboard_code_conversion_win.cc b/app/keyboard_code_conversion_win.cc deleted file mode 100644 index 2a7da8f..0000000 --- a/app/keyboard_code_conversion_win.cc +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "app/keyboard_code_conversion_win.h" - -namespace app { - -WORD WindowsKeyCodeForKeyboardCode(app::KeyboardCode keycode) { - return static_cast<WORD>(keycode); -} - -app::KeyboardCode KeyboardCodeForWindowsKeyCode(WORD keycode) { - return static_cast<app::KeyboardCode>(keycode); -} - -} // namespace app diff --git a/app/keyboard_code_conversion_win.h b/app/keyboard_code_conversion_win.h deleted file mode 100644 index eaf3105..0000000 --- a/app/keyboard_code_conversion_win.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef APP_KEYBOARD_CODE_CONVERSION_WIN_H_ -#define APP_KEYBOARD_CODE_CONVERSION_WIN_H_ -#pragma once - -#include "app/keyboard_codes.h" - -namespace app { - -// Methods to convert app::KeyboardCode/Windows virtual key type methods. -WORD WindowsKeyCodeForKeyboardCode(app::KeyboardCode keycode); -app::KeyboardCode KeyboardCodeForWindowsKeyCode(WORD keycode); - -} // namespace app - -#endif // APP_KEYBOARD_CODE_CONVERSION_WIN_H_ diff --git a/app/keyboard_code_conversion_x.h b/app/keyboard_code_conversion_x.h deleted file mode 100644 index 748ef86..0000000 --- a/app/keyboard_code_conversion_x.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef APP_KEYBOARD_CODE_CONVERSION_X_H_ -#define APP_KEYBOARD_CODE_CONVERSION_X_H_ - -#include "app/keyboard_codes_posix.h" - -typedef union _XEvent XEvent; - -namespace app { - -KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev); - -} // namespace app - -#endif // APP_KEYBOARD_CODE_CONVERSION_X_H_ diff --git a/app/keyboard_codes.h b/app/keyboard_codes.h deleted file mode 100644 index 9325825..0000000 --- a/app/keyboard_codes.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef APP_KEYBOARD_CODES_H_ -#define APP_KEYBOARD_CODES_H_ -#pragma once - -#include "build/build_config.h" - -#if defined(OS_WIN) -#include "app/keyboard_codes_win.h" -#elif defined(OS_POSIX) -#include "app/keyboard_codes_posix.h" -#endif - -#endif // APP_KEYBOARD_CODES_H_ diff --git a/app/menus/accelerator.h b/app/menus/accelerator.h index 399569b..fbdb49c 100644 --- a/app/menus/accelerator.h +++ b/app/menus/accelerator.h @@ -6,7 +6,7 @@ #define APP_MENUS_ACCELERATOR_H_ #pragma once -#include "app/keyboard_codes.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace menus { @@ -15,9 +15,9 @@ namespace menus { class Accelerator { public: - Accelerator() : key_code_(app::VKEY_UNKNOWN), modifiers_(0) {} + Accelerator() : key_code_(ui::VKEY_UNKNOWN), modifiers_(0) {} - Accelerator(app::KeyboardCode keycode, int modifiers) + Accelerator(ui::KeyboardCode keycode, int modifiers) : key_code_(keycode), modifiers_(modifiers) {} @@ -52,7 +52,7 @@ class Accelerator { return !(*this == rhs); } - app::KeyboardCode GetKeyCode() const { + ui::KeyboardCode GetKeyCode() const { return key_code_; } @@ -62,7 +62,7 @@ class Accelerator { protected: // The keycode (VK_...). - app::KeyboardCode key_code_; + ui::KeyboardCode key_code_; // The state of the Shift/Ctrl/Alt keys (platform-dependent). int modifiers_; diff --git a/app/menus/accelerator_cocoa.h b/app/menus/accelerator_cocoa.h index 71227fe..f3ae109 100644 --- a/app/menus/accelerator_cocoa.h +++ b/app/menus/accelerator_cocoa.h @@ -20,7 +20,7 @@ namespace menus { class AcceleratorCocoa : public Accelerator { public: AcceleratorCocoa(NSString* key_code, NSUInteger mask) - : Accelerator(app::VKEY_UNKNOWN, mask), + : Accelerator(ui::VKEY_UNKNOWN, mask), characters_([key_code copy]) { } diff --git a/app/menus/accelerator_gtk.h b/app/menus/accelerator_gtk.h index ca92f03..c286930 100644 --- a/app/menus/accelerator_gtk.h +++ b/app/menus/accelerator_gtk.h @@ -8,15 +8,15 @@ #include <gdk/gdk.h> -#include "app/keyboard_code_conversion_gtk.h" -#include "app/keyboard_codes_posix.h" #include "app/menus/accelerator.h" +#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" +#include "ui/base/keycodes/keyboard_codes_posix.h" namespace menus { class AcceleratorGtk : public Accelerator { public: - AcceleratorGtk(app::KeyboardCode key_code, + AcceleratorGtk(ui::KeyboardCode key_code, bool shift_pressed, bool ctrl_pressed, bool alt_pressed) : gdk_keyval_(0) { key_code_ = key_code; @@ -30,7 +30,7 @@ class AcceleratorGtk : public Accelerator { } AcceleratorGtk(guint keyval, GdkModifierType modifier_type) { - key_code_ = app::WindowsKeyCodeForGdkKeyCode(keyval); + key_code_ = ui::WindowsKeyCodeForGdkKeyCode(keyval); gdk_keyval_ = keyval; modifiers_ = modifier_type; } @@ -42,7 +42,7 @@ class AcceleratorGtk : public Accelerator { return gdk_keyval_ > 0 ? // The second parameter is false because accelerator keys are // expressed in terms of the non-shift-modified key. - gdk_keyval_ : app::GdkKeyCodeForWindowsKeyCode(key_code_, false); + gdk_keyval_ : ui::GdkKeyCodeForWindowsKeyCode(key_code_, false); } GdkModifierType gdk_modifier_type() { diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc index 7577b72..0b8dfcc 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc @@ -4,7 +4,6 @@ #include <stdio.h> -#include "app/keyboard_codes.h" #include "base/message_loop.h" #include "base/string16.h" #include "base/string_util.h" @@ -31,6 +30,7 @@ #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "net/base/mock_host_resolver.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/event.h" #if defined(OS_LINUX) @@ -45,24 +45,24 @@ namespace { const char kSearchKeyword[] = "foo"; const wchar_t kSearchKeywordKeys[] = { - app::VKEY_F, app::VKEY_O, app::VKEY_O, 0 + ui::VKEY_F, ui::VKEY_O, ui::VKEY_O, 0 }; const char kSearchURL[] = "http://www.foo.com/search?q={searchTerms}"; const char kSearchShortName[] = "foo"; const char kSearchText[] = "abc"; const wchar_t kSearchTextKeys[] = { - app::VKEY_A, app::VKEY_B, app::VKEY_C, 0 + ui::VKEY_A, ui::VKEY_B, ui::VKEY_C, 0 }; const char kSearchTextURL[] = "http://www.foo.com/search?q=abc"; const char kSearchSingleChar[] = "z"; -const wchar_t kSearchSingleCharKeys[] = { app::VKEY_Z, 0 }; +const wchar_t kSearchSingleCharKeys[] = { ui::VKEY_Z, 0 }; const char kSearchSingleCharURL[] = "http://www.foo.com/search?q=z"; const char kHistoryPageURL[] = "chrome://history/#q=abc"; const char kDesiredTLDHostname[] = "www.bar.com"; const wchar_t kDesiredTLDKeys[] = { - app::VKEY_B, app::VKEY_A, app::VKEY_R, 0 + ui::VKEY_B, ui::VKEY_A, ui::VKEY_R, 0 }; // Hostnames that shall be blocked by host resolver. @@ -145,7 +145,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, } static void SendKeyForBrowser(const Browser* browser, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt) { @@ -153,13 +153,13 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, browser, key, control, shift, alt, false /* command */)); } - void SendKey(app::KeyboardCode key, bool control, bool shift, bool alt) { + void SendKey(ui::KeyboardCode key, bool control, bool shift, bool alt) { SendKeyForBrowser(browser(), key, control, shift, alt); } void SendKeySequence(const wchar_t* keys) { for (; *keys; ++keys) - ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<app::KeyboardCode>(*keys), + ASSERT_NO_FATAL_FAILURE(SendKey(static_cast<ui::KeyboardCode>(*keys), false, false, false)); } @@ -320,43 +320,43 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, FLAKY_BrowserAccelerators) { ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count + 1)); // Select the first Tab. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_1, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_1, true, false, false)); ASSERT_EQ(0, browser()->selected_index()); browser()->FocusLocationBar(); // Select the second Tab. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_2, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_2, true, false, false)); ASSERT_EQ(1, browser()->selected_index()); browser()->FocusLocationBar(); // Try ctrl-w to close a Tab. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_W, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_W, true, false, false)); ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count)); // Try ctrl-l to focus location bar. edit_view->SetUserText(L"Hello world"); EXPECT_FALSE(edit_view->IsSelectAll()); - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_L, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_L, true, false, false)); EXPECT_TRUE(edit_view->IsSelectAll()); // Try editing the location bar text. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RIGHT, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RIGHT, false, false, false)); EXPECT_FALSE(edit_view->IsSelectAll()); - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_S, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_S, false, false, false)); EXPECT_EQ(L"Hello worlds", edit_view->GetText()); // Try ctrl-x to cut text. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_LEFT, true, true, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_LEFT, true, true, false)); EXPECT_FALSE(edit_view->IsSelectAll()); - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_X, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_X, true, false, false)); EXPECT_EQ(L"Hello ", edit_view->GetText()); #if !defined(OS_CHROMEOS) // Try alt-f4 to close the browser. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_F4, false, false, true, false, + browser(), ui::VKEY_F4, false, false, true, false, NotificationType::BROWSER_CLOSED, Source<Browser>(browser()))); #endif } @@ -373,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PopupAccelerators) { // Try ctrl-w to close the popup. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - popup, app::VKEY_W, true, false, false, false, + popup, ui::VKEY_W, true, false, false, false, NotificationType::BROWSER_CLOSED, Source<Browser>(popup))); // Create another popup. @@ -387,25 +387,25 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PopupAccelerators) { EXPECT_TRUE(edit_view->IsSelectAll()); // Try editing the location bar text -- should be disallowed. - ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, app::VKEY_RIGHT, false, + ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, ui::VKEY_RIGHT, false, false, false)); EXPECT_FALSE(edit_view->IsSelectAll()); - ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, app::VKEY_S, false, false, + ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, ui::VKEY_S, false, false, false)); EXPECT_EQ(L"Hello world", edit_view->GetText()); // Try ctrl-x to cut text -- should be disallowed. - ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, app::VKEY_LEFT, true, true, + ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, ui::VKEY_LEFT, true, true, false)); EXPECT_FALSE(edit_view->IsSelectAll()); - ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, app::VKEY_X, true, false, + ASSERT_NO_FATAL_FAILURE(SendKeyForBrowser(popup, ui::VKEY_X, true, false, false)); EXPECT_EQ(L"Hello world", edit_view->GetText()); #if !defined(OS_CHROMEOS) // Try alt-f4 to close the popup. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - popup, app::VKEY_F4, false, false, true, false, + popup, ui::VKEY_F4, false, false, true, false, NotificationType::BROWSER_CLOSED, Source<Browser>(popup))); #endif } @@ -425,17 +425,17 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) { ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword())); // Trigger keyword mode. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_TAB, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, false, false, false)); ASSERT_FALSE(edit_view->model()->is_keyword_hint()); ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword())); // Backspace without search text should bring back keyword hint mode. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); ASSERT_TRUE(edit_view->model()->is_keyword_hint()); ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword())); // Trigger keyword mode again. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_TAB, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB, false, false, false)); ASSERT_FALSE(edit_view->model()->is_keyword_hint()); ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword())); @@ -445,7 +445,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) { // Should stay in keyword mode while deleting search text by pressing // backspace. for (size_t i = 0; i < arraysize(kSearchText) - 1; ++i) { - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); ASSERT_FALSE(edit_view->model()->is_keyword_hint()); ASSERT_EQ(kSearchKeyword, WideToUTF8(edit_view->model()->keyword())); } @@ -454,10 +454,10 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) { ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchTextKeys)); // Move cursor to the beginning of the search text. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_HOME, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_HOME, false, false, false)); // Backspace at the beginning of the search text shall turn off // the keyword mode. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); ASSERT_FALSE(edit_view->model()->is_keyword_hint()); ASSERT_EQ(std::string(), WideToUTF8(edit_view->model()->keyword())); ASSERT_EQ(std::string(kSearchKeyword) + kSearchText, @@ -479,11 +479,11 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, Escape) { EXPECT_TRUE(edit_view->IsSelectAll()); // Delete all text in omnibox. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); EXPECT_TRUE(edit_view->GetText().empty()); // Escape shall revert the text in omnibox. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_ESCAPE, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, false, false, false)); EXPECT_EQ(old_text, edit_view->GetText()); EXPECT_TRUE(edit_view->IsSelectAll()); } @@ -504,7 +504,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, DesiredTLD) { ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); ASSERT_TRUE(popup_model->IsOpen()); // ctrl-Enter triggers desired_tld feature, thus www.bar.com shall be opened. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, true, false, false)); GURL url = browser()->GetSelectedTabContents()->GetURL(); EXPECT_STREQ(kDesiredTLDHostname, url.host().c_str()); @@ -522,7 +522,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, AltEnter) { edit_view->SetUserText(ASCIIToWide(chrome::kChromeUIHistoryURL)); int tab_count = browser()->tab_count(); // alt-Enter opens a new tab. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, true)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, false, false, true)); ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count + 1)); } @@ -548,7 +548,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToSearch) { popup_model->result().default_match()->type); // Open the default match. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, false, false, false)); GURL url = browser()->GetSelectedTabContents()->GetURL(); EXPECT_STREQ(kSearchTextURL, url.spec().c_str()); @@ -565,7 +565,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToSearch) { popup_model->result().default_match()->type); // Open the default match. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, false, false, false)); url = browser()->GetSelectedTabContents()->GetURL(); EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str()); } @@ -595,7 +595,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToOpenHistoryPage) { AutocompleteMatch::OPEN_HISTORY_PAGE) break; size_t old_selected_line = popup_model->selected_line(); - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_DOWN, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, false, false, false)); ASSERT_EQ(old_selected_line + 1, popup_model->selected_line()); if (popup_model->selected_line() == size - 1) break; @@ -606,7 +606,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToOpenHistoryPage) { popup_model->result().match_at(popup_model->selected_line()).type); // Open the history page item. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, false, false, false)); GURL url = browser()->GetSelectedTabContents()->GetURL(); EXPECT_STREQ(kHistoryPageURL, url.spec().c_str()); } @@ -638,7 +638,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) { // Move to another line with different text. size_t size = popup_model->result().size(); while (popup_model->selected_line() < size - 1) { - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_DOWN, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DOWN, false, false, false)); ASSERT_NE(old_selected_line, popup_model->selected_line()); if (old_text != edit_view->GetText()) break; @@ -647,7 +647,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) { EXPECT_NE(old_text, edit_view->GetText()); // Escape shall revert back to the default match item. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_ESCAPE, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_ESCAPE, false, false, false)); EXPECT_EQ(old_text, edit_view->GetText()); EXPECT_EQ(old_selected_line, popup_model->selected_line()); } @@ -672,7 +672,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BasicTextOperations) { EXPECT_EQ(old_text.size(), end); // Move the cursor to the end. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_END, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, false, false, false)); EXPECT_FALSE(edit_view->IsSelectAll()); // Make sure the cursor is placed correctly. @@ -682,12 +682,12 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BasicTextOperations) { // Insert one character at the end. Make sure we won't insert anything after // the special ZWS mark used in gtk implementation. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_A, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_A, false, false, false)); EXPECT_EQ(old_text + L"a", edit_view->GetText()); // Delete one character from the end. Make sure we won't delete the special // ZWS mark used in gtk implementation. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); EXPECT_EQ(old_text, edit_view->GetText()); edit_view->SelectAll(true); @@ -697,7 +697,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BasicTextOperations) { EXPECT_EQ(old_text.size(), end); // Delete the content - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_DELETE, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_DELETE, false, false, false)); EXPECT_TRUE(edit_view->IsSelectAll()); edit_view->GetSelectionBounds(&start, &end); EXPECT_EQ(0U, start); @@ -729,15 +729,15 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, UndoRedoLinux) { EXPECT_TRUE(edit_view->IsSelectAll()); // Undo should clear the omnibox. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, false, false)); EXPECT_TRUE(edit_view->GetText().empty()); // Nothing should happen if undo again. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, false, false)); EXPECT_TRUE(edit_view->GetText().empty()); // Redo should restore the original text. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, true, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, true, false)); EXPECT_EQ(old_text, edit_view->GetText()); // Looks like the undo manager doesn't support restoring selection. @@ -750,33 +750,33 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, UndoRedoLinux) { EXPECT_EQ(old_text.size(), end); // Delete two characters. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); EXPECT_EQ(old_text.substr(0, old_text.size() - 2), edit_view->GetText()); // Undo delete. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, false, false)); EXPECT_EQ(old_text, edit_view->GetText()); // Redo delete. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, true, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, true, false)); EXPECT_EQ(old_text.substr(0, old_text.size() - 2), edit_view->GetText()); // Delete everything. edit_view->SelectAll(true); - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); EXPECT_TRUE(edit_view->GetText().empty()); // Undo delete everything. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, false, false)); EXPECT_EQ(old_text.substr(0, old_text.size() - 2), edit_view->GetText()); // Undo delete two characters. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, false, false)); EXPECT_EQ(old_text, edit_view->GetText()); // Undo again. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_Z, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_Z, true, false, false)); EXPECT_TRUE(edit_view->GetText().empty()); } @@ -791,17 +791,17 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PrimarySelection) { EXPECT_FALSE(edit_view->IsSelectAll()); // Move the cursor to the end. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_END, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, false, false, false)); // Select all text by pressing Shift+Home - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_HOME, false, true, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_HOME, false, true, false)); EXPECT_TRUE(edit_view->IsSelectAll()); // The selected content should be saved to the PRIMARY clipboard. EXPECT_EQ("Hello world", GetPrimarySelectionText()); // Move the cursor to the end. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_END, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, false, false, false)); EXPECT_FALSE(edit_view->IsSelectAll()); // The content in the PRIMARY clipboard should not be cleared. @@ -820,10 +820,10 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, edit_view->SetUserText(UTF8ToWide("\357\276\200\357\276\236")); // Move the cursor to the end. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_END, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_END, false, false, false)); // Backspace should delete one character. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, false, false, false)); EXPECT_EQ(UTF8ToWide("\357\276\200"), edit_view->GetText()); } @@ -842,7 +842,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PasteReplacingAll) { SetClipboardText(kSearchText); // Paste text. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_V, true, false, false)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_V, true, false, false)); ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone()); ASSERT_TRUE(popup_model->IsOpen()); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index fb8e740..7b9354d 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -11,7 +11,6 @@ #include <richedit.h> #include <textserv.h> -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/win/drag_source.h" @@ -50,6 +49,7 @@ #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider_win.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/drag_utils.h" #include "views/focus/focus_util_win.h" #include "views/widget/widget.h" @@ -957,10 +957,10 @@ void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( const views::KeyEvent& e) { - app::KeyboardCode key = e.GetKeyCode(); + ui::KeyboardCode key = e.GetKeyCode(); // We don't process ALT + numpad digit as accelerators, they are used for // entering special characters. We do translate alt-home. - if (e.IsAltDown() && (key != app::VKEY_HOME) && + if (e.IsAltDown() && (key != ui::VKEY_HOME) && app::win::IsNumPadDigit(key, e.IsExtendedKey())) return true; @@ -972,28 +972,28 @@ bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( // accelerators (e.g., F5 for reload the page should work even when the // Omnibox gets focused). switch (key) { - case app::VKEY_ESCAPE: { + case ui::VKEY_ESCAPE: { ScopedFreeze freeze(this, GetTextObjectModel()); return model_->OnEscapeKeyPressed(); } - case app::VKEY_RETURN: + case ui::VKEY_RETURN: return true; - case app::VKEY_UP: - case app::VKEY_DOWN: + case ui::VKEY_UP: + case ui::VKEY_DOWN: return !e.IsAltDown(); - case app::VKEY_DELETE: - case app::VKEY_INSERT: + case ui::VKEY_DELETE: + case ui::VKEY_INSERT: return !e.IsAltDown() && e.IsShiftDown() && !e.IsControlDown(); - case app::VKEY_X: - case app::VKEY_V: + case ui::VKEY_X: + case ui::VKEY_V: return !e.IsAltDown() && e.IsControlDown(); - case app::VKEY_BACK: - case app::VKEY_OEM_PLUS: + case ui::VKEY_BACK: + case ui::VKEY_OEM_PLUS: return true; default: @@ -1795,7 +1795,7 @@ void AutocompleteEditViewWin::HandleKeystroke(UINT message, ScopedFreeze freeze(this, GetTextObjectModel()); 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/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index baf2843..799c28c 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -5,7 +5,6 @@ #include <string> #include "base/utf_string_conversions.h" -#include "app/keyboard_code_conversion.h" #include "base/basictypes.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" @@ -28,6 +27,7 @@ #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/keycodes/keyboard_code_conversion.h" static const char* kTestFormString = "<form action=\"http://www.google.com/\" method=\"POST\">" @@ -157,14 +157,14 @@ class AutoFillTest : public InProcessBrowserTest { // Start filling the first name field with "M" and wait for the popup to be // shown. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_M, false, true, false, false, + browser(), ui::VKEY_M, false, true, false, false, NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, Source<RenderViewHost>(rvh()))); // Press the down arrow to select the suggestion and preview the autofilled // form. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_DOWN, false, false, false, false, + browser(), ui::VKEY_DOWN, false, false, false, false, NotificationType::AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(rvh()))); @@ -183,7 +183,7 @@ class AutoFillTest : public InProcessBrowserTest { // Press Enter to accept the autofill suggestions. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_RETURN, false, false, false, false, + browser(), ui::VKEY_RETURN, false, false, false, false, NotificationType::AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(rvh()))); diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index a2d142a..5646c75 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -4,7 +4,6 @@ #include "chrome/browser/automation/automation_provider.h" -#include "app/keyboard_codes.h" #include "base/debug/trace_event.h" #include "base/json/json_reader.h" #include "base/utf_string_conversions.h" @@ -24,6 +23,7 @@ #include "chrome/browser/ui/views/bookmark_bar_view.h" #include "chrome/common/automation_messages.h" #include "chrome/common/page_zoom.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/focus/accelerator_handler.h" #include "views/widget/root_view.h" #include "views/widget/widget_win.h" @@ -203,7 +203,7 @@ void AutomationProvider::WindowSimulateDrag(int handle, // Press Escape, making sure we wait until chrome processes the escape. // TODO(phajdan.jr): make this use ui_test_utils::SendKeyPressSync. ui_controls::SendKeyPressNotifyWhenDone( - window, app::VKEY_ESCAPE, + window, ui::VKEY_ESCAPE, ((flags & views::Event::EF_CONTROL_DOWN) == views::Event::EF_CONTROL_DOWN), ((flags & views::Event::EF_SHIFT_DOWN) == diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 9b6c303..9012d3c 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -869,7 +869,7 @@ void TestingAutomationProvider::WindowSimulateKeyPress( gfx::NativeWindow window = window_tracker_->GetResource(handle); // The key event is sent to whatever window is active. - ui_controls::SendKeyPress(window, static_cast<app::KeyboardCode>(key), + ui_controls::SendKeyPress(window, static_cast<ui::KeyboardCode>(key), ((flags & views::Event::EF_CONTROL_DOWN) == views::Event::EF_CONTROL_DOWN), ((flags & views::Event::EF_SHIFT_DOWN) == diff --git a/chrome/browser/automation/ui_controls.h b/chrome/browser/automation/ui_controls.h index 3664567..25fa4f6 100644 --- a/chrome/browser/automation/ui_controls.h +++ b/chrome/browser/automation/ui_controls.h @@ -12,9 +12,9 @@ #include <wtypes.h> #endif -#include "app/keyboard_codes.h" #include "gfx/native_widget_types.h" #include "gfx/point.h" +#include "ui/base/keycodes/keyboard_codes.h" #if defined(TOOLKIT_VIEWS) namespace views { @@ -46,13 +46,13 @@ namespace ui_controls { // If you're writing a test chances are you want the variant in ui_test_utils. // See it for details. bool SendKeyPress(gfx::NativeWindow window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, bool command); bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, diff --git a/chrome/browser/automation/ui_controls_linux.cc b/chrome/browser/automation/ui_controls_linux.cc index 21cd0dd..1b814e5 100644 --- a/chrome/browser/automation/ui_controls_linux.cc +++ b/chrome/browser/automation/ui_controls_linux.cc @@ -96,7 +96,7 @@ void FakeAMouseMotionEvent(gint x, gint y) { namespace ui_controls { bool SendKeyPress(gfx::NativeWindow window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, bool command) { DCHECK(command == false); // No command key on Linux GdkWindow* event_window = NULL; @@ -137,7 +137,7 @@ bool SendKeyPress(gfx::NativeWindow window, } bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, bool command, Task* task) { diff --git a/chrome/browser/automation/ui_controls_mac.mm b/chrome/browser/automation/ui_controls_mac.mm index 03f7e2c..6e8bcc9 100644 --- a/chrome/browser/automation/ui_controls_mac.mm +++ b/chrome/browser/automation/ui_controls_mac.mm @@ -8,10 +8,10 @@ #include <mach/mach_time.h> #include <vector> -#include "app/keyboard_code_conversion_mac.h" #include "base/message_loop.h" #include "chrome/browser/automation/ui_controls_internal.h" #include "chrome/browser/browser_thread.h" +#include "ui/base/keycodes/keyboard_code_conversion_mac.h" // Implementation details: We use [NSApplication sendEvent:] instead // of [NSApplication postEvent:atStart:] so that the event gets sent @@ -76,11 +76,11 @@ NSTimeInterval TimeIntervalSinceSystemStartup() { // Creates and returns an autoreleased key event. NSEvent* SynthesizeKeyEvent(NSWindow* window, bool keyDown, - app::KeyboardCode keycode, + ui::KeyboardCode keycode, NSUInteger flags) { unichar character; unichar characterIgnoringModifiers; - int macKeycode = app::MacKeyCodeForWindowsKeyCode( + int macKeycode = ui::MacKeyCodeForWindowsKeyCode( keycode, flags, &character, &characterIgnoringModifiers); if (macKeycode < 0) @@ -97,8 +97,8 @@ NSEvent* SynthesizeKeyEvent(NSWindow* window, // Modifier keys generate NSFlagsChanged event rather than // NSKeyDown/NSKeyUp events. - if (keycode == app::VKEY_CONTROL || keycode == app::VKEY_SHIFT || - keycode == app::VKEY_MENU || keycode == app::VKEY_COMMAND) + if (keycode == ui::VKEY_CONTROL || keycode == ui::VKEY_SHIFT || + keycode == ui::VKEY_MENU || keycode == ui::VKEY_COMMAND) type = NSFlagsChanged; // For events other than mouse moved, [event locationInWindow] is @@ -121,7 +121,7 @@ NSEvent* SynthesizeKeyEvent(NSWindow* window, // Creates the proper sequence of autoreleased key events for a key down + up. void SynthesizeKeyEventsSequence(NSWindow* window, - app::KeyboardCode keycode, + ui::KeyboardCode keycode, bool control, bool shift, bool alt, @@ -131,25 +131,25 @@ void SynthesizeKeyEventsSequence(NSWindow* window, NSUInteger flags = 0; if (control) { flags |= NSControlKeyMask; - event = SynthesizeKeyEvent(window, true, app::VKEY_CONTROL, flags); + event = SynthesizeKeyEvent(window, true, ui::VKEY_CONTROL, flags); DCHECK(event); events->push_back(event); } if (shift) { flags |= NSShiftKeyMask; - event = SynthesizeKeyEvent(window, true, app::VKEY_SHIFT, flags); + event = SynthesizeKeyEvent(window, true, ui::VKEY_SHIFT, flags); DCHECK(event); events->push_back(event); } if (alt) { flags |= NSAlternateKeyMask; - event = SynthesizeKeyEvent(window, true, app::VKEY_MENU, flags); + event = SynthesizeKeyEvent(window, true, ui::VKEY_MENU, flags); DCHECK(event); events->push_back(event); } if (command) { flags |= NSCommandKeyMask; - event = SynthesizeKeyEvent(window, true, app::VKEY_COMMAND, flags); + event = SynthesizeKeyEvent(window, true, ui::VKEY_COMMAND, flags); DCHECK(event); events->push_back(event); } @@ -163,25 +163,25 @@ void SynthesizeKeyEventsSequence(NSWindow* window, if (command) { flags &= ~NSCommandKeyMask; - event = SynthesizeKeyEvent(window, false, app::VKEY_COMMAND, flags); + event = SynthesizeKeyEvent(window, false, ui::VKEY_COMMAND, flags); DCHECK(event); events->push_back(event); } if (alt) { flags &= ~NSAlternateKeyMask; - event = SynthesizeKeyEvent(window, false, app::VKEY_MENU, flags); + event = SynthesizeKeyEvent(window, false, ui::VKEY_MENU, flags); DCHECK(event); events->push_back(event); } if (shift) { flags &= ~NSShiftKeyMask; - event = SynthesizeKeyEvent(window, false, app::VKEY_SHIFT, flags); + event = SynthesizeKeyEvent(window, false, ui::VKEY_SHIFT, flags); DCHECK(event); events->push_back(event); } if (control) { flags &= ~NSControlKeyMask; - event = SynthesizeKeyEvent(window, false, app::VKEY_CONTROL, flags); + event = SynthesizeKeyEvent(window, false, ui::VKEY_CONTROL, flags); DCHECK(event); events->push_back(event); } @@ -221,7 +221,7 @@ NSPoint g_mouse_location = { 0, 0 }; namespace ui_controls { bool SendKeyPress(gfx::NativeWindow window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, @@ -234,7 +234,7 @@ bool SendKeyPress(gfx::NativeWindow window, // Win and Linux implement a SendKeyPress() this as a // SendKeyPressAndRelease(), so we should as well (despite the name). bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, diff --git a/chrome/browser/automation/ui_controls_win.cc b/chrome/browser/automation/ui_controls_win.cc index b03c97b..127ea6d 100644 --- a/chrome/browser/automation/ui_controls_win.cc +++ b/chrome/browser/automation/ui_controls_win.cc @@ -4,12 +4,12 @@ #include "chrome/browser/automation/ui_controls.h" -#include "app/keyboard_code_conversion_win.h" -#include "app/keyboard_codes.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/ref_counted.h" #include "base/task.h" +#include "ui/base/keycodes/keyboard_codes.h" +#include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "views/view.h" namespace ui_controls { @@ -139,10 +139,10 @@ void InputDispatcher::NotifyTask() { // Populate the INPUT structure with the appropriate keyboard event // parameters required by SendInput -bool FillKeyboardInput(app::KeyboardCode key, INPUT* input, bool key_up) { +bool FillKeyboardInput(ui::KeyboardCode key, INPUT* input, bool key_up) { memset(input, 0, sizeof(INPUT)); input->type = INPUT_KEYBOARD; - input->ki.wVk = app::WindowsKeyCodeForKeyboardCode(key); + input->ki.wVk = ui::WindowsKeyCodeForKeyboardCode(key); input->ki.dwFlags = key_up ? KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP : KEYEVENTF_EXTENDEDKEY; @@ -150,7 +150,7 @@ bool FillKeyboardInput(app::KeyboardCode key, INPUT* input, bool key_up) { } // Send a key event (up/down) -bool SendKeyEvent(app::KeyboardCode key, bool up) { +bool SendKeyEvent(ui::KeyboardCode key, bool up) { INPUT input = { 0 }; if (!FillKeyboardInput(key, &input, up)) @@ -162,7 +162,7 @@ bool SendKeyEvent(app::KeyboardCode key, bool up) { return true; } -bool SendKeyPressImpl(app::KeyboardCode key, +bool SendKeyPressImpl(ui::KeyboardCode key, bool control, bool shift, bool alt, Task* task) { scoped_refptr<InputDispatcher> dispatcher( @@ -173,7 +173,7 @@ bool SendKeyPressImpl(app::KeyboardCode key, // exists, send the key event directly there. HWND popup_menu = ::FindWindow(L"#32768", 0); if (popup_menu != NULL && popup_menu == ::GetTopWindow(NULL)) { - WPARAM w_param = app::WindowsKeyCodeForKeyboardCode(key); + WPARAM w_param = ui::WindowsKeyCodeForKeyboardCode(key); LPARAM l_param = 0; ::SendMessage(popup_menu, WM_KEYDOWN, w_param, l_param); ::SendMessage(popup_menu, WM_KEYUP, w_param, l_param); @@ -187,19 +187,19 @@ bool SendKeyPressImpl(app::KeyboardCode key, UINT i = 0; if (control) { - if (!FillKeyboardInput(app::VKEY_CONTROL, &input[i], false)) + if (!FillKeyboardInput(ui::VKEY_CONTROL, &input[i], false)) return false; i++; } if (shift) { - if (!FillKeyboardInput(app::VKEY_SHIFT, &input[i], false)) + if (!FillKeyboardInput(ui::VKEY_SHIFT, &input[i], false)) return false; i++; } if (alt) { - if (!FillKeyboardInput(app::VKEY_MENU, &input[i], false)) + if (!FillKeyboardInput(ui::VKEY_MENU, &input[i], false)) return false; i++; } @@ -213,19 +213,19 @@ bool SendKeyPressImpl(app::KeyboardCode key, i++; if (alt) { - if (!FillKeyboardInput(app::VKEY_MENU, &input[i], true)) + if (!FillKeyboardInput(ui::VKEY_MENU, &input[i], true)) return false; i++; } if (shift) { - if (!FillKeyboardInput(app::VKEY_SHIFT, &input[i], true)) + if (!FillKeyboardInput(ui::VKEY_SHIFT, &input[i], true)) return false; i++; } if (control) { - if (!FillKeyboardInput(app::VKEY_CONTROL, &input[i], true)) + if (!FillKeyboardInput(ui::VKEY_CONTROL, &input[i], true)) return false; i++; } @@ -325,14 +325,14 @@ bool SendMouseEventsImpl(MouseButton type, int state, Task* task) { // public functions ----------------------------------------------------------- -bool SendKeyPress(gfx::NativeWindow window, app::KeyboardCode key, +bool SendKeyPress(gfx::NativeWindow window, ui::KeyboardCode key, bool control, bool shift, bool alt, bool command) { DCHECK(command == false); // No command key on Windows return SendKeyPressImpl(key, control, shift, alt, NULL); } bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, bool command, Task* task) { diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index abf7614..2396dc6 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -313,7 +313,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { ASSERT_TRUE(IsViewFocused(vid)); ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_TAB, true, false, false, false)); + browser(), ui::VKEY_TAB, true, false, false, false)); } // As above, but with ctrl+shift+tab. @@ -324,7 +324,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { ASSERT_TRUE(IsViewFocused(vid)); ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_TAB, true, true, false, false)); + browser(), ui::VKEY_TAB, true, true, false, false)); } } } @@ -485,7 +485,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { Details<bool> details(&is_editable_node); ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( - browser(), app::VKEY_TAB, false, false, false, false, + browser(), ui::VKEY_TAB, false, false, false, false, NotificationType::FOCUS_CHANGED_IN_PAGE, NotificationSource(Source<RenderViewHost>( browser()->GetSelectedTabContents()->render_view_host())), @@ -493,7 +493,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { } else { // On the last tab key press, the focus returns to the browser. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_TAB, false, false, false, false, + browser(), ui::VKEY_TAB, false, false, false, false, NotificationType::FOCUS_RETURNED_TO_BROWSER, NotificationSource(Source<Browser>(browser())))); } @@ -524,7 +524,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { Details<bool> details(&is_editable_node); ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( - browser(), app::VKEY_TAB, false, true, false, false, + browser(), ui::VKEY_TAB, false, true, false, false, NotificationType::FOCUS_CHANGED_IN_PAGE, NotificationSource(Source<RenderViewHost>( browser()->GetSelectedTabContents()->render_view_host())), @@ -532,7 +532,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { } else { // On the last tab key press, the focus returns to the browser. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_TAB, false, true, false, false, + browser(), ui::VKEY_TAB, false, true, false, false, NotificationType::FOCUS_RETURNED_TO_BROWSER, NotificationSource(Source<Browser>(browser())))); } @@ -615,7 +615,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { } ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_TAB, false, false, false, false, + browser(), ui::VKEY_TAB, false, false, false, false, notification_type, notification_source)); } @@ -646,7 +646,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { } ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( - browser(), app::VKEY_TAB, false, true, false, false, + browser(), ui::VKEY_TAB, false, true, false, false, notification_type, notification_source)); // Let's make sure the focus is on the expected element in the page. @@ -715,11 +715,11 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { #if defined(OS_MACOSX) // Press Cmd+F, which will make the Find box open and request focus. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_F, false, false, false, true)); + browser(), ui::VKEY_F, false, false, false, true)); #else // Press Ctrl+F, which will make the Find box open and request focus. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_F, true, false, false, false)); + browser(), ui::VKEY_F, true, false, false, false)); #endif // Ideally, we wouldn't sleep here and instead would intercept the @@ -739,10 +739,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { // Now press Ctrl+F again and focus should move to the Find box. #if defined(OS_MACOSX) ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_F, false, false, false, true)); + browser(), ui::VKEY_F, false, false, false, true)); #else ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_F, true, false, false, false)); + browser(), ui::VKEY_F, true, false, false, false)); #endif ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); @@ -753,10 +753,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { // Now press Ctrl+F again and focus should move to the Find box. #if defined(OS_MACOSX) ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_F, false, false, false, true)); + browser(), ui::VKEY_F, false, false, false, true)); #else ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_F, true, false, false, false)); + browser(), ui::VKEY_F, true, false, false, false)); #endif // See remark above on why we wait. diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index 5b8ecd7..dd025b6 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -4,7 +4,6 @@ #include "build/build_config.h" -#include "app/keyboard_codes.h" #include "base/basictypes.h" #include "base/logging.h" #include "base/message_loop.h" @@ -23,6 +22,7 @@ #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "net/test/test_server.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace { @@ -61,7 +61,7 @@ const size_t kMaxResultLength = 10; // input. // Please refer to chrome/test/data/keyevents_test.html for details. struct KeyEventTestData { - app::KeyboardCode key; + ui::KeyboardCode key; bool ctrl; bool shift; bool alt; @@ -289,13 +289,13 @@ class BrowserKeyEventsTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, NormalKeyEvents) { static const KeyEventTestData kTestNoInput[] = { // a - { app::VKEY_A, false, false, false, false, + { ui::VKEY_A, false, false, false, false, false, false, false, false, 3, { "D 65 0 false false false false", "P 97 97 false false false false", "U 65 0 false false false false" } }, // shift-a - { app::VKEY_A, false, true, false, false, + { ui::VKEY_A, false, true, false, false, false, false, false, false, 5, { "D 16 0 false true false false", "D 65 0 false true false false", @@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, NormalKeyEvents) { "U 65 0 false true false false", "U 16 0 false true false false" } }, // a, suppress keydown - { app::VKEY_A, false, false, false, false, + { ui::VKEY_A, false, false, false, false, true, false, false, false, 2, { "D 65 0 false false false false", "U 65 0 false false false false" } }, @@ -311,14 +311,14 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, NormalKeyEvents) { static const KeyEventTestData kTestWithInput[] = { // a - { app::VKEY_A, false, false, false, false, + { ui::VKEY_A, false, false, false, false, false, false, false, false, 4, { "D 65 0 false false false false", "P 97 97 false false false false", "T a", "U 65 0 false false false false" } }, // shift-a - { app::VKEY_A, false, true, false, false, + { ui::VKEY_A, false, true, false, false, false, false, false, false, 6, { "D 16 0 false true false false", "D 65 0 false true false false", @@ -327,18 +327,18 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, NormalKeyEvents) { "U 65 0 false true false false", "U 16 0 false true false false" } }, // a, suppress keydown - { app::VKEY_A, false, false, false, false, + { ui::VKEY_A, false, false, false, false, true, false, false, false, 2, { "D 65 0 false false false false", "U 65 0 false false false false" } }, // a, suppress keypress - { app::VKEY_A, false, false, false, false, + { ui::VKEY_A, false, false, false, false, false, true, false, false, 3, { "D 65 0 false false false false", "P 97 97 false false false false", "U 65 0 false false false false" } }, // a, suppress textInput - { app::VKEY_A, false, false, false, false, + { ui::VKEY_A, false, false, false, false, false, false, false, true, 4, { "D 65 0 false false false false", "P 97 97 false false false false", @@ -384,14 +384,14 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, NormalKeyEvents) { #if defined(OS_WIN) || defined(OS_LINUX) IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CtrlKeyEvents) { static const KeyEventTestData kTestCtrlF = { - app::VKEY_F, true, false, false, false, + ui::VKEY_F, true, false, false, false, false, false, false, false, 2, { "D 17 0 true false false false", "D 70 0 true false false false" } }; static const KeyEventTestData kTestCtrlFSuppressKeyDown = { - app::VKEY_F, true, false, false, false, + ui::VKEY_F, true, false, false, false, true, false, false, false, 4, { "D 17 0 true false false false", "D 70 0 true false false false", @@ -402,7 +402,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CtrlKeyEvents) { // Ctrl+Z doesn't bind to any accelerators, which then should generate a // keypress event with charCode=26. static const KeyEventTestData kTestCtrlZ = { - app::VKEY_Z, true, false, false, false, + ui::VKEY_Z, true, false, false, false, false, false, false, false, 5, { "D 17 0 true false false false", "D 90 0 true false false false", @@ -412,7 +412,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CtrlKeyEvents) { }; static const KeyEventTestData kTestCtrlZSuppressKeyDown = { - app::VKEY_Z, true, false, false, false, + ui::VKEY_Z, true, false, false, false, true, false, false, false, 4, { "D 17 0 true false false false", "D 90 0 true false false false", @@ -422,7 +422,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CtrlKeyEvents) { // Ctrl+Enter shall generate a keypress event with charCode=10 (LF). static const KeyEventTestData kTestCtrlEnter = { - app::VKEY_RETURN, true, false, false, false, + ui::VKEY_RETURN, true, false, false, false, false, false, false, false, 5, { "D 17 0 true false false false", "D 13 0 true false false false", @@ -447,7 +447,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CtrlKeyEvents) { // Press Escape to close the Find box and move the focus back to the web page. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_ESCAPE, false, false, false, false)); + browser(), ui::VKEY_ESCAPE, false, false, false, false)); ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); // Press Ctrl+F with keydown suppressed shall not open the find box. @@ -461,7 +461,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CtrlKeyEvents) { #elif defined(OS_MACOSX) IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CommandKeyEvents) { static const KeyEventTestData kTestCmdF = { - app::VKEY_F, false, false, false, true, + ui::VKEY_F, false, false, false, true, false, false, false, false, 2, { "D 91 0 false false false true", "D 70 0 false false false true" } @@ -469,7 +469,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CommandKeyEvents) { // On Mac we don't send key up events when command modifier is down. static const KeyEventTestData kTestCmdFSuppressKeyDown = { - app::VKEY_F, false, false, false, true, + ui::VKEY_F, false, false, false, true, true, false, false, false, 3, { "D 91 0 false false false true", "D 70 0 false false false true", @@ -492,7 +492,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CommandKeyEvents) { // Press Escape to close the Find box and move the focus back to the web page. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_ESCAPE, false, false, false, false)); + browser(), ui::VKEY_ESCAPE, false, false, false, false)); ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); // Press Cmd+F with keydown suppressed shall not open the find box. @@ -505,7 +505,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { #if defined(OS_MACOSX) // On Mac, access keys use ctrl+alt modifiers. static const KeyEventTestData kTestAccessA = { - app::VKEY_A, true, false, true, false, + ui::VKEY_A, true, false, true, false, false, false, false, false, 6, { "D 17 0 true false false false", "D 18 0 true false true false", @@ -516,7 +516,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { }; static const KeyEventTestData kTestAccessDSuppress = { - app::VKEY_D, true, false, true, false, + ui::VKEY_D, true, false, true, false, true, true, true, false, 6, { "D 17 0 true false false false", "D 18 0 true false true false", @@ -527,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { }; static const KeyEventTestData kTestAccess1 = { - app::VKEY_1, true, false, true, false, + ui::VKEY_1, true, false, true, false, false, false, false, false, 6, { "D 17 0 true false false false", "D 18 0 true false true false", @@ -538,7 +538,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { }; #else static const KeyEventTestData kTestAccessA = { - app::VKEY_A, false, false, true, false, + ui::VKEY_A, false, false, true, false, false, false, false, false, 4, { "D 18 0 false false true false", "D 65 0 false false true false", @@ -547,14 +547,14 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { }; static const KeyEventTestData kTestAccessD = { - app::VKEY_D, false, false, true, false, + ui::VKEY_D, false, false, true, false, false, false, false, false, 2, { "D 18 0 false false true false", "D 68 0 false false true false" } }; static const KeyEventTestData kTestAccessDSuppress = { - app::VKEY_D, false, false, true, false, + ui::VKEY_D, false, false, true, false, true, true, true, false, 4, { "D 18 0 false false true false", "D 68 0 false false true false", @@ -563,7 +563,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { }; static const KeyEventTestData kTestAccess1 = { - app::VKEY_1, false, false, true, false, + ui::VKEY_1, false, false, true, false, false, false, false, false, 4, { "D 18 0 false false true false", "D 49 0 false false true false", @@ -651,11 +651,11 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_ReservedAccelerators) { static const KeyEventTestData kTestCtrlOrCmdT = { #if defined(OS_MACOSX) - app::VKEY_T, false, false, false, true, + ui::VKEY_T, false, false, false, true, true, false, false, false, 1, { "D 91 0 false false false true" } #else - app::VKEY_T, true, false, false, false, + ui::VKEY_T, true, false, false, false, true, false, false, false, 1, { "D 17 0 true false false false" } #endif @@ -698,10 +698,10 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_ReservedAccelerators) { // Press Ctrl/Cmd+W, which will close the tab. #if defined(OS_MACOSX) ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_W, false, false, false, true)); + browser(), ui::VKEY_W, false, false, false, true)); #else ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_W, true, false, false, false)); + browser(), ui::VKEY_W, true, false, false, false)); #endif ASSERT_NO_FATAL_FAILURE(wait_for_tab_closed.Wait()); @@ -712,7 +712,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_ReservedAccelerators) { #if defined(OS_MACOSX) IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) { static const KeyEventTestData kTestCtrlA = { - app::VKEY_A, true, false, false, false, + ui::VKEY_A, true, false, false, false, false, false, false, false, 4, { "D 17 0 true false false false", "D 65 0 true false false false", @@ -721,7 +721,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) { }; static const KeyEventTestData kTestCtrlF = { - app::VKEY_F, true, false, false, false, + ui::VKEY_F, true, false, false, false, false, false, false, false, 4, { "D 17 0 true false false false", "D 70 0 true false false false", @@ -730,7 +730,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) { }; static const KeyEventTestData kTestCtrlK = { - app::VKEY_K, true, false, false, false, + ui::VKEY_K, true, false, false, false, false, false, false, false, 4, { "D 17 0 true false false false", "D 75 0 true false false false", @@ -762,14 +762,14 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) { IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, PageUpDownKeys) { static const KeyEventTestData kTestPageUp = { - app::VKEY_PRIOR, false, false, false, false, + ui::VKEY_PRIOR, false, false, false, false, false, false, false, false, 2, { "D 33 0 false false false false", "U 33 0 false false false false" } }; static const KeyEventTestData kTestPageDown = { - app::VKEY_NEXT, false, false, false, false, + ui::VKEY_NEXT, false, false, false, false, false, false, false, false, 2, { "D 34 0 false false false false", "U 34 0 false false false false" } @@ -794,21 +794,21 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, PageUpDownKeys) { #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, FocusMenuBarByAltKey) { static const KeyEventTestData kTestAltKey = { - app::VKEY_MENU, false, false, false, false, + ui::VKEY_MENU, false, false, false, false, false, false, false, false, 2, { "D 18 0 false false true false", "U 18 0 false false true false" } }; static const KeyEventTestData kTestAltKeySuppress = { - app::VKEY_MENU, false, false, false, false, + ui::VKEY_MENU, false, false, false, false, true, false, false, false, 2, { "D 18 0 false false true false", "U 18 0 false false true false" } }; static const KeyEventTestData kTestCtrlAltKey = { - app::VKEY_MENU, true, false, false, false, + ui::VKEY_MENU, true, false, false, false, false, false, false, false, 4, { "D 17 0 true false false false", "D 18 0 true false true false", diff --git a/chrome/browser/chromeos/login/captcha_view.cc b/chrome/browser/chromeos/login/captcha_view.cc index ca2438f..88658fc 100644 --- a/chrome/browser/chromeos/login/captcha_view.cc +++ b/chrome/browser/chromeos/login/captcha_view.cc @@ -123,7 +123,7 @@ void CaptchaView::ViewHierarchyChanged(bool is_add, bool CaptchaView::HandleKeyEvent(views::Textfield* sender, const views::KeyEvent& key_event) { if (sender == captcha_textfield_ && - key_event.GetKeyCode() == app::VKEY_RETURN) { + key_event.GetKeyCode() == ui::VKEY_RETURN) { if (is_standalone_) { Accept(); } else { diff --git a/chrome/browser/chromeos/login/existing_user_view.cc b/chrome/browser/chromeos/login/existing_user_view.cc index 2c3176e..26bb6ba 100644 --- a/chrome/browser/chromeos/login/existing_user_view.cc +++ b/chrome/browser/chromeos/login/existing_user_view.cc @@ -33,13 +33,13 @@ class UserEntryTextfield : public TextfieldWithMargin { // Overridden from views::View: virtual bool OnKeyPressed(const views::KeyEvent& e) { - if (e.GetKeyCode() == app::VKEY_TAB) { + if (e.GetKeyCode() == ui::VKEY_TAB) { controller_->SelectUserRelative(e.IsShiftDown() ? -1 : 1); return true; - } else if (e.GetKeyCode() == app::VKEY_LEFT) { + } else if (e.GetKeyCode() == ui::VKEY_LEFT) { controller_->SelectUserRelative(-1); return true; - } else if (e.GetKeyCode() == app::VKEY_RIGHT) { + } else if (e.GetKeyCode() == ui::VKEY_RIGHT) { controller_->SelectUserRelative(1); return true; } else { @@ -48,7 +48,7 @@ class UserEntryTextfield : public TextfieldWithMargin { } virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { - if (e.GetKeyCode() == app::VKEY_TAB) + if (e.GetKeyCode() == ui::VKEY_TAB) return true; else return views::Textfield::SkipDefaultKeyEventProcessing(e); @@ -65,7 +65,7 @@ ExistingUserView::ExistingUserView(UserController* user_controller) : user_controller_(user_controller), password_field_(NULL), accel_login_off_the_record_( - views::Accelerator(app::VKEY_B, false, false, true)), + views::Accelerator(ui::VKEY_B, false, false, true)), accel_toggle_accessibility_( WizardAccessibilityHelper::GetAccelerator()) { AddAccelerator(accel_login_off_the_record_); @@ -104,7 +104,7 @@ bool ExistingUserView::AcceleratorPressed( bool ExistingUserView::HandleKeyEvent(views::Textfield* sender, const views::KeyEvent& key_event) { - if (key_event.GetKeyCode() == app::VKEY_RETURN) { + if (key_event.GetKeyCode() == ui::VKEY_RETURN) { if (!password_field_->text().empty()) user_controller_->OnLogin("", UTF16ToUTF8(password_field_->text())); } else { diff --git a/chrome/browser/chromeos/login/guest_user_view.cc b/chrome/browser/chromeos/login/guest_user_view.cc index 0fcc48d..0dd63124 100644 --- a/chrome/browser/chromeos/login/guest_user_view.cc +++ b/chrome/browser/chromeos/login/guest_user_view.cc @@ -23,7 +23,7 @@ class UserEntryButton : public login::WideButton { // Overridden from views::View: virtual bool OnKeyPressed(const views::KeyEvent& e) { - if (e.GetKeyCode() == app::VKEY_TAB) { + if (e.GetKeyCode() == ui::VKEY_TAB) { user_controller_->SelectUserRelative(e.IsShiftDown() ? -1 : 1); return true; } @@ -31,7 +31,7 @@ class UserEntryButton : public login::WideButton { } virtual bool SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { - if (e.GetKeyCode() == app::VKEY_TAB) + if (e.GetKeyCode() == ui::VKEY_TAB) return true; return WideButton::SkipDefaultKeyEventProcessing(e); } @@ -49,11 +49,11 @@ GuestUserView::GuestUserView(UserController* uc) accel_toggle_accessibility_( WizardAccessibilityHelper::GetAccelerator()), accel_login_off_the_record_( - views::Accelerator(app::VKEY_B, false, false, true)), + views::Accelerator(ui::VKEY_B, false, false, true)), accel_previous_pod_by_arrow_( - views::Accelerator(app::VKEY_LEFT, false, false, false)), + views::Accelerator(ui::VKEY_LEFT, false, false, false)), accel_next_pod_by_arrow_( - views::Accelerator(app::VKEY_RIGHT, false, false, false)) { + views::Accelerator(ui::VKEY_RIGHT, false, false, false)) { AddAccelerator(accel_toggle_accessibility_); AddAccelerator(accel_login_off_the_record_); AddAccelerator(accel_previous_pod_by_arrow_); diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc index cd2508c..6a40795 100644 --- a/chrome/browser/chromeos/login/new_user_view.cc +++ b/chrome/browser/chromeos/login/new_user_view.cc @@ -10,7 +10,6 @@ #include <algorithm> #include <vector> -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/callback.h" @@ -29,6 +28,7 @@ #include "grit/app_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/controls/label.h" #include "views/controls/throbber.h" #include "views/widget/widget_gtk.h" @@ -81,7 +81,7 @@ class UsernameField : public chromeos::TextfieldWithMargin { // Overridden from views::View: virtual bool OnKeyPressed(const views::KeyEvent& e) { - if (e.GetKeyCode() == app::VKEY_LEFT) { + if (e.GetKeyCode() == ui::VKEY_LEFT) { return controller_->NavigateAway(); } return false; @@ -111,10 +111,10 @@ NewUserView::NewUserView(Delegate* delegate, create_account_link_(NULL), guest_link_(NULL), languages_menubutton_(NULL), - accel_focus_pass_(views::Accelerator(app::VKEY_P, false, false, true)), - accel_focus_user_(views::Accelerator(app::VKEY_U, false, false, true)), + accel_focus_pass_(views::Accelerator(ui::VKEY_P, false, false, true)), + accel_focus_user_(views::Accelerator(ui::VKEY_U, false, false, true)), accel_login_off_the_record_( - views::Accelerator(app::VKEY_B, false, false, true)), + views::Accelerator(ui::VKEY_B, false, false, true)), accel_toggle_accessibility_(WizardAccessibilityHelper::GetAccelerator()), delegate_(delegate), ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), @@ -530,7 +530,7 @@ bool NewUserView::HandleKeyEvent(views::Textfield* sender, if (!CrosLibrary::Get()->EnsureLoaded() || login_in_process_) return false; - if (key_event.GetKeyCode() == app::VKEY_RETURN) { + if (key_event.GetKeyCode() == ui::VKEY_RETURN) { if (!username_field_->text().empty() && !password_field_->text().empty()) Login(); // Return true so that processing ends diff --git a/chrome/browser/chromeos/login/password_changed_view.cc b/chrome/browser/chromeos/login/password_changed_view.cc index 3c3b835..8cb01d5 100644 --- a/chrome/browser/chromeos/login/password_changed_view.cc +++ b/chrome/browser/chromeos/login/password_changed_view.cc @@ -4,7 +4,6 @@ #include "chrome/browser/chromeos/login/password_changed_view.h" -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/utf_string_conversions.h" @@ -12,6 +11,7 @@ #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/controls/button/radio_button.h" #include "views/controls/label.h" #include "views/grid_layout.h" diff --git a/chrome/browser/chromeos/login/screen_lock_view.cc b/chrome/browser/chromeos/login/screen_lock_view.cc index 0e9aa50..4508501 100644 --- a/chrome/browser/chromeos/login/screen_lock_view.cc +++ b/chrome/browser/chromeos/login/screen_lock_view.cc @@ -191,7 +191,7 @@ bool ScreenLockView::HandleKeyEvent( views::Textfield* sender, const views::KeyEvent& key_event) { screen_locker_->ClearErrors(); - if (key_event.GetKeyCode() == app::VKEY_RETURN) { + if (key_event.GetKeyCode() == ui::VKEY_RETURN) { screen_locker_->Authenticate(password_field_->text()); return true; } diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index 09de9ef..5bc78cb 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -994,7 +994,7 @@ ScreenLocker::~ScreenLocker() { MessageLoopForUI::current()->RemoveObserver(input_event_observer_.get()); if (locker_input_event_observer_.get()) { lock_widget_->GetFocusManager()->UnregisterAccelerator( - views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); + views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); MessageLoopForUI::current()->RemoveObserver( locker_input_event_observer_.get()); } @@ -1029,7 +1029,7 @@ void ScreenLocker::ScreenLockReady() { if (background_view_->ScreenSaverEnabled()) { lock_widget_->GetFocusManager()->RegisterAccelerator( - views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); + views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); locker_input_event_observer_.reset(new LockerInputEventObserver(this)); MessageLoopForUI::current()->AddObserver( locker_input_event_observer_.get()); diff --git a/chrome/browser/chromeos/login/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/screen_locker_browsertest.cc index 2488b36..7b52c00 100644 --- a/chrome/browser/chromeos/login/screen_locker_browsertest.cc +++ b/chrome/browser/chromeos/login/screen_locker_browsertest.cc @@ -256,7 +256,7 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestNoPasswordWithMouseClick) { void KeyPress(views::Widget* widget) { ui_controls::SendKeyPress(GTK_WINDOW(widget->GetNativeView()), - app::VKEY_SPACE, false, false, false, false); + ui::VKEY_SPACE, false, false, false, false); } IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestNoPasswordWithKeyPress) { diff --git a/chrome/browser/chromeos/login/wizard_accessibility_helper.cc b/chrome/browser/chromeos/login/wizard_accessibility_helper.cc index c8c8668..955b1e4 100644 --- a/chrome/browser/chromeos/login/wizard_accessibility_helper.cc +++ b/chrome/browser/chromeos/login/wizard_accessibility_helper.cc @@ -27,7 +27,7 @@ scoped_ptr<views::Accelerator> WizardAccessibilityHelper::accelerator_; views::Accelerator WizardAccessibilityHelper::GetAccelerator() { if (!WizardAccessibilityHelper::accelerator_.get()) WizardAccessibilityHelper::accelerator_.reset( - new views::Accelerator(app::VKEY_Z, false, true, true)); + new views::Accelerator(ui::VKEY_Z, false, true, true)); return *(WizardAccessibilityHelper::accelerator_.get()); } diff --git a/chrome/browser/chromeos/login/wizard_accessibility_helper.h b/chrome/browser/chromeos/login/wizard_accessibility_helper.h index 76c151a..3c057f6 100644 --- a/chrome/browser/chromeos/login/wizard_accessibility_helper.h +++ b/chrome/browser/chromeos/login/wizard_accessibility_helper.h @@ -9,12 +9,12 @@ #include <map> #include <vector> -#include "app/keyboard_codes.h" #include "base/scoped_ptr.h" #include "base/singleton.h" #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h" #include "chrome/browser/ui/views/accessible_view_helper.h" #include "chrome/common/notification_registrar.h" +#include "ui/base/keycodes/keyboard_codes.h" class Profile; namespace views { diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 26c33e6..d1c2702 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -82,24 +82,24 @@ class ContentView : public views::View { : accel_toggle_accessibility_( chromeos::WizardAccessibilityHelper::GetAccelerator()) { #if defined(OFFICIAL_BUILD) - accel_cancel_update_ = views::Accelerator(app::VKEY_ESCAPE, + accel_cancel_update_ = views::Accelerator(ui::VKEY_ESCAPE, true, true, true); #else - accel_cancel_update_ = views::Accelerator(app::VKEY_ESCAPE, + accel_cancel_update_ = views::Accelerator(ui::VKEY_ESCAPE, false, false, false); - accel_account_screen_ = views::Accelerator(app::VKEY_A, + accel_account_screen_ = views::Accelerator(ui::VKEY_A, false, true, true); - accel_login_screen_ = views::Accelerator(app::VKEY_L, + accel_login_screen_ = views::Accelerator(ui::VKEY_L, false, true, true); - accel_network_screen_ = views::Accelerator(app::VKEY_N, + accel_network_screen_ = views::Accelerator(ui::VKEY_N, false, true, true); - accel_update_screen_ = views::Accelerator(app::VKEY_U, + accel_update_screen_ = views::Accelerator(ui::VKEY_U, false, true, true); - accel_image_screen_ = views::Accelerator(app::VKEY_I, + accel_image_screen_ = views::Accelerator(ui::VKEY_I, false, true, true); - accel_eula_screen_ = views::Accelerator(app::VKEY_E, + accel_eula_screen_ = views::Accelerator(ui::VKEY_E, false, true, true); - accel_register_screen_ = views::Accelerator(app::VKEY_R, + accel_register_screen_ = views::Accelerator(ui::VKEY_R, false, true, true); AddAccelerator(accel_account_screen_); AddAccelerator(accel_login_screen_); diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index 1104be2..d2a1ef9 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc @@ -220,11 +220,11 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, MAYBE_Accelerators) { views::FocusManager* focus_manager = controller()->contents()->GetFocusManager(); - views::Accelerator accel_account_screen(app::VKEY_A, false, true, true); - views::Accelerator accel_network_screen(app::VKEY_N, false, true, true); - views::Accelerator accel_update_screen(app::VKEY_U, false, true, true); - views::Accelerator accel_image_screen(app::VKEY_I, false, true, true); - views::Accelerator accel_eula_screen(app::VKEY_E, false, true, true); + views::Accelerator accel_account_screen(ui::VKEY_A, false, true, true); + views::Accelerator accel_network_screen(ui::VKEY_N, false, true, true); + views::Accelerator accel_update_screen(ui::VKEY_U, false, true, true); + views::Accelerator accel_image_screen(ui::VKEY_I, false, true, true); + views::Accelerator accel_eula_screen(ui::VKEY_E, false, true, true); EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); EXPECT_CALL(*mock_account_screen_, Show()).Times(1); diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc index 9b8fdd8..2f2740e 100644 --- a/chrome/browser/chromeos/options/wifi_config_view.cc +++ b/chrome/browser/chromeos/options/wifi_config_view.cc @@ -152,7 +152,7 @@ void WifiConfigView::ContentsChanged(views::Textfield* sender, bool WifiConfigView::HandleKeyEvent(views::Textfield* sender, const views::KeyEvent& key_event) { if (sender == passphrase_textfield_ && - key_event.GetKeyCode() == app::VKEY_RETURN) { + key_event.GetKeyCode() == ui::VKEY_RETURN) { parent_->GetDialogClientView()->AcceptWindow(); } return false; diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 58c2a67..0ceb891 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -6,7 +6,6 @@ #include <list> -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/message_loop.h" @@ -49,6 +48,7 @@ #include "chrome/common/view_types.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/context_menu.h" #if defined(TOOLKIT_VIEWS) @@ -707,7 +707,7 @@ bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { if (extension_host_type_ == ViewType::EXTENSION_POPUP && event.type == NativeWebKeyboardEvent::RawKeyDown && - event.windowsKeyCode == app::VKEY_ESCAPE) { + event.windowsKeyCode == ui::VKEY_ESCAPE) { DCHECK(is_keyboard_shortcut != NULL); *is_keyboard_shortcut = true; } @@ -717,7 +717,7 @@ bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { if (extension_host_type_ == ViewType::EXTENSION_POPUP) { if (event.type == NativeWebKeyboardEvent::RawKeyDown && - event.windowsKeyCode == app::VKEY_ESCAPE) { + event.windowsKeyCode == ui::VKEY_ESCAPE) { NotificationService::current()->Notify( NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(profile_), diff --git a/chrome/browser/extensions/extension_input_api.cc b/chrome/browser/extensions/extension_input_api.cc index bb308f4..b59cf0e 100644 --- a/chrome/browser/extensions/extension_input_api.cc +++ b/chrome/browser/extensions/extension_input_api.cc @@ -6,7 +6,6 @@ #include <string> -#include "app/keyboard_code_conversion.h" #include "base/string_util.h" #include "base/values.h" #include "chrome/browser/browser_window.h" @@ -16,6 +15,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/native_web_keyboard_event.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "ui/base/keycodes/keyboard_code_conversion.h" #include "views/event.h" #include "views/widget/root_view.h" @@ -86,8 +86,8 @@ bool SendKeyboardEventInputFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args->GetString(kKeyIdentifier, &identifier)); TrimWhitespaceASCII(identifier, TRIM_ALL, &identifier); - app::KeyboardCode code = app::KeyCodeFromKeyIdentifier(identifier); - if (code == app::VKEY_UNKNOWN) { + ui::KeyboardCode code = ui::KeyCodeFromKeyIdentifier(identifier); + if (code == ui::VKEY_UNKNOWN) { error_ = kUnknownOrUnsupportedKeyIdentiferError; return false; } diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 780854e..b8523c7 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -1022,7 +1022,7 @@ void ExternalTabContainer::LoadAccelerators() { bool ctrl_down = (accelerators[i].fVirt & FCONTROL) == FCONTROL; bool shift_down = (accelerators[i].fVirt & FSHIFT) == FSHIFT; views::Accelerator accelerator( - static_cast<app::KeyboardCode>(accelerators[i].key), + static_cast<ui::KeyboardCode>(accelerators[i].key), shift_down, ctrl_down, alt_down); accelerator_table_[accelerator] = accelerators[i].cmd; diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index a06c702..c8499f8 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -8,7 +8,6 @@ #include <string> -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "base/base_paths.h" #include "base/command_line.h" @@ -87,6 +86,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace { diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index 6eaca52..816b4a3 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -111,7 +111,7 @@ class InstantTest : public InProcessBrowserTest { NotificationType::INSTANT_CONTROLLER_SHOWN); } - void SendKey(app::KeyboardCode key) { + void SendKey(ui::KeyboardCode key) { ASSERT_TRUE(ui_test_utils::SendKeyPressSync( browser(), key, false, false, false, false)); } @@ -480,7 +480,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, OnSubmitEvent) { ASSERT_NO_FATAL_FAILURE(SetupPreview()); ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc")); - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_RETURN)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN)); // Check that the preview contents have been committed. ASSERT_FALSE(browser()->instant()->GetPreviewContents()); @@ -534,7 +534,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_TabKey) { ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc")); // Pressing tab to convert instant suggest into inline autocomplete. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_TAB)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB)); ASSERT_EQ(L"abcdef", location_bar_->location_entry()->GetText()); @@ -542,7 +542,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_TabKey) { GetSearchStateAsString(preview_)); // Pressing tab again to accept the current instant preview. - ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_TAB)); + ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_TAB)); // Check that the preview contents have been committed. ASSERT_FALSE(browser()->instant()->GetPreviewContents()); diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index 6848483..10e7261 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -4,7 +4,6 @@ #include "chrome/browser/renderer_host/render_widget_host.h" -#include "app/keyboard_codes.h" #include "base/auto_reset.h" #include "base/command_line.h" #include "base/message_loop.h" @@ -23,6 +22,7 @@ #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/webplugin.h" @@ -540,8 +540,8 @@ void RenderWidgetHost::ForwardKeyboardEvent( return; if (key_event.type == WebKeyboardEvent::Char && - (key_event.windowsKeyCode == app::VKEY_RETURN || - key_event.windowsKeyCode == app::VKEY_SPACE)) { + (key_event.windowsKeyCode == ui::VKEY_RETURN || + key_event.windowsKeyCode == ui::VKEY_SPACE)) { OnUserGesture(); } diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc index 86bf0b4..c5dbd43 100644 --- a/chrome/browser/renderer_host/render_widget_host_unittest.cc +++ b/chrome/browser/renderer_host/render_widget_host_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/keyboard_codes.h" #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/shared_memory.h" @@ -17,6 +16,7 @@ #include "chrome/test/testing_profile.h" #include "gfx/canvas_skia.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/keycodes/keyboard_codes.h" using base::TimeDelta; @@ -276,7 +276,7 @@ class RenderWidgetHostTest : public testing::Test { void SimulateKeyboardEvent(WebInputEvent::Type type) { NativeWebKeyboardEvent key_event; key_event.type = type; - key_event.windowsKeyCode = app::VKEY_L; // non-null made up value. + key_event.windowsKeyCode = ui::VKEY_L; // non-null made up value. host_->ForwardKeyboardEvent(key_event); } diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc index 55fc12c..89fc7b47 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc @@ -7,7 +7,6 @@ #include <algorithm> #include <string> -#include "app/keyboard_code_conversion_gtk.h" #include "app/l10n_util.h" #include "app/x11_util.h" #include "base/command_line.h" @@ -25,6 +24,7 @@ #include "gfx/canvas.h" #include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" #include "views/event.h" #include "views/widget/widget.h" #include "views/widget/widget_gtk.h" diff --git a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm index 611ecdd..361579d 100644 --- a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm +++ b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm @@ -4,7 +4,6 @@ #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" -#include "app/keyboard_codes.h" #include "base/logging.h" #include "base/scoped_nsobject.h" #include "base/sys_string_conversions.h" @@ -17,6 +16,7 @@ #include "chrome/common/native_web_keyboard_event.h" #include "gfx/size.h" #include "ipc/ipc_message.h" +#include "ui/base/keycodes/keyboard_codes.h" // Thin bridge that routes notifications to // HtmlDialogWindowController's member variables. @@ -195,8 +195,8 @@ void HtmlDialogWindowDelegateBridge::HandleKeyboardEvent( // TODO(thakis): It would be nice to get cancel: to work somehow. // Bug: http://code.google.com/p/chromium/issues/detail?id=32828 . if (event.type == NativeWebKeyboardEvent::RawKeyDown && - ((event.windowsKeyCode == app::VKEY_ESCAPE) || - (event.windowsKeyCode == app::VKEY_OEM_PERIOD && + ((event.windowsKeyCode == ui::VKEY_ESCAPE) || + (event.windowsKeyCode == ui::VKEY_OEM_PERIOD && event.modifiers == NativeWebKeyboardEvent::MetaKey))) { [controller_ close]; return; diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 06a7b12..b673175 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/keyboard_codes.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -20,6 +19,7 @@ #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "net/test/test_server.h" +#include "ui/base/keycodes/keyboard_codes.h" #if defined(TOOLKIT_VIEWS) #include "chrome/browser/ui/views/find_bar_host.h" @@ -739,7 +739,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, browser()->window()->GetNativeHandle()); // See where Escape is registered. - views::Accelerator escape(app::VKEY_ESCAPE, false, false, false); + views::Accelerator escape(ui::VKEY_ESCAPE, false, false, false); views::AcceleratorTarget* old_target = focus_manager->GetCurrentTargetForAccelerator(escape); EXPECT_TRUE(old_target != NULL); diff --git a/chrome/browser/ui/views/accelerator_table_gtk.cc b/chrome/browser/ui/views/accelerator_table_gtk.cc index 5a3d0f7..025714b 100644 --- a/chrome/browser/ui/views/accelerator_table_gtk.cc +++ b/chrome/browser/ui/views/accelerator_table_gtk.cc @@ -4,9 +4,9 @@ #include "chrome/browser/ui/views/accelerator_table_gtk.h" -#include "app/keyboard_codes.h" #include "base/basictypes.h" #include "chrome/app/chrome_command_ids.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace browser { @@ -14,144 +14,144 @@ namespace browser { // the Windows accelerators in ../../app/chrome_dll.rc. const AcceleratorMapping kAcceleratorMap[] = { // Keycode Shift Ctrl Alt Command ID - { app::VKEY_A, true, true, false, IDC_AUTOFILL_DEFAULT }, - { app::VKEY_LEFT, false, false, true, IDC_BACK }, - { app::VKEY_BACK, false, false, false, IDC_BACK }, + { ui::VKEY_A, true, true, false, IDC_AUTOFILL_DEFAULT }, + { ui::VKEY_LEFT, false, false, true, IDC_BACK }, + { ui::VKEY_BACK, false, false, false, IDC_BACK }, #if defined(OS_CHROMEOS) - { app::VKEY_F1, false, false, false, IDC_BACK }, + { ui::VKEY_F1, false, false, false, IDC_BACK }, // TODO(mazda): Change VKEY_1 to VKEY_OME_2 once the new version of the // keyboard overlay is ready. - { app::VKEY_1, false, true, true, IDC_SHOW_KEYBOARD_OVERLAY }, + { ui::VKEY_1, false, true, true, IDC_SHOW_KEYBOARD_OVERLAY }, #endif - { app::VKEY_D, false, true, false, IDC_BOOKMARK_PAGE }, - { app::VKEY_D, true, true, false, IDC_BOOKMARK_ALL_TABS }, - { app::VKEY_DELETE, true, true, false, IDC_CLEAR_BROWSING_DATA }, + { ui::VKEY_D, false, true, false, IDC_BOOKMARK_PAGE }, + { ui::VKEY_D, true, true, false, IDC_BOOKMARK_ALL_TABS }, + { ui::VKEY_DELETE, true, true, false, IDC_CLEAR_BROWSING_DATA }, #if !defined(OS_CHROMEOS) - { app::VKEY_F4, false, true, false, IDC_CLOSE_TAB }, + { ui::VKEY_F4, false, true, false, IDC_CLOSE_TAB }, #endif - { app::VKEY_W, false, true, false, IDC_CLOSE_TAB }, - { app::VKEY_W, true, true, false, IDC_CLOSE_WINDOW }, + { ui::VKEY_W, false, true, false, IDC_CLOSE_TAB }, + { ui::VKEY_W, true, true, false, IDC_CLOSE_WINDOW }, #if !defined(OS_CHROMEOS) - { app::VKEY_F4, false, false, true, IDC_CLOSE_WINDOW }, + { ui::VKEY_F4, false, false, true, IDC_CLOSE_WINDOW }, #endif - { app::VKEY_Q, true, true, false, IDC_EXIT }, - { app::VKEY_F, false, true, false, IDC_FIND }, - { app::VKEY_G, false, true, false, IDC_FIND_NEXT }, + { ui::VKEY_Q, true, true, false, IDC_EXIT }, + { ui::VKEY_F, false, true, false, IDC_FIND }, + { ui::VKEY_G, false, true, false, IDC_FIND_NEXT }, #if !defined(OS_CHROMEOS) - { app::VKEY_F3, false, false, false, IDC_FIND_NEXT }, + { ui::VKEY_F3, false, false, false, IDC_FIND_NEXT }, #endif - { app::VKEY_G, true, true, false, IDC_FIND_PREVIOUS }, + { ui::VKEY_G, true, true, false, IDC_FIND_PREVIOUS }, #if !defined(OS_CHROMEOS) - { app::VKEY_F3, true, false, false, IDC_FIND_PREVIOUS }, + { ui::VKEY_F3, true, false, false, IDC_FIND_PREVIOUS }, #endif #if defined(OS_CHROMEOS) - { app::VKEY_S, true, false, true, IDC_FOCUS_CHROMEOS_STATUS }, + { ui::VKEY_S, true, false, true, IDC_FOCUS_CHROMEOS_STATUS }, #endif - { app::VKEY_D, false, false, true, IDC_FOCUS_LOCATION }, - { app::VKEY_L, false, true, false, IDC_FOCUS_LOCATION }, + { ui::VKEY_D, false, false, true, IDC_FOCUS_LOCATION }, + { ui::VKEY_L, false, true, false, IDC_FOCUS_LOCATION }, #if !defined(OS_CHROMEOS) - { app::VKEY_F10, false, false, false, IDC_FOCUS_MENU_BAR }, + { ui::VKEY_F10, false, false, false, IDC_FOCUS_MENU_BAR }, #endif - { app::VKEY_MENU, false, false, false, IDC_FOCUS_MENU_BAR }, + { ui::VKEY_MENU, false, false, false, IDC_FOCUS_MENU_BAR }, #if !defined(OS_CHROMEOS) - { app::VKEY_F6, false, false, false, IDC_FOCUS_NEXT_PANE }, + { ui::VKEY_F6, false, false, false, IDC_FOCUS_NEXT_PANE }, #endif #if defined(OS_CHROMEOS) - { app::VKEY_F2, false, true, false, IDC_FOCUS_NEXT_PANE }, + { ui::VKEY_F2, false, true, false, IDC_FOCUS_NEXT_PANE }, #endif #if !defined(OS_CHROMEOS) - { app::VKEY_F6, true, false, false, IDC_FOCUS_PREVIOUS_PANE }, + { ui::VKEY_F6, true, false, false, IDC_FOCUS_PREVIOUS_PANE }, #endif #if defined(OS_CHROMEOS) - { app::VKEY_F1, false, true, false, IDC_FOCUS_PREVIOUS_PANE }, -#endif - { app::VKEY_K, false, true, false, IDC_FOCUS_SEARCH }, - { app::VKEY_E, false, true, false, IDC_FOCUS_SEARCH }, - { app::VKEY_BROWSER_SEARCH, false, false, false, IDC_FOCUS_SEARCH }, - { app::VKEY_T, true, false, true, IDC_FOCUS_TOOLBAR }, - { app::VKEY_B, true, false, true, IDC_FOCUS_BOOKMARKS }, - { app::VKEY_RIGHT, false, false, true, IDC_FORWARD }, - { app::VKEY_BACK, true, false, false, IDC_FORWARD }, + { ui::VKEY_F1, false, true, false, IDC_FOCUS_PREVIOUS_PANE }, +#endif + { ui::VKEY_K, false, true, false, IDC_FOCUS_SEARCH }, + { ui::VKEY_E, false, true, false, IDC_FOCUS_SEARCH }, + { ui::VKEY_BROWSER_SEARCH, false, false, false, IDC_FOCUS_SEARCH }, + { ui::VKEY_T, true, false, true, IDC_FOCUS_TOOLBAR }, + { ui::VKEY_B, true, false, true, IDC_FOCUS_BOOKMARKS }, + { ui::VKEY_RIGHT, false, false, true, IDC_FORWARD }, + { ui::VKEY_BACK, true, false, false, IDC_FORWARD }, #if defined(OS_CHROMEOS) - { app::VKEY_F2, false, false, false, IDC_FORWARD }, + { ui::VKEY_F2, false, false, false, IDC_FORWARD }, #endif #if !defined(OS_CHROMEOS) - { app::VKEY_F11, false, false, false, IDC_FULLSCREEN }, + { ui::VKEY_F11, false, false, false, IDC_FULLSCREEN }, #endif #if defined(OS_CHROMEOS) - { app::VKEY_F4, false, false, false, IDC_FULLSCREEN }, + { ui::VKEY_F4, false, false, false, IDC_FULLSCREEN }, #endif #if !defined(OS_CHROMEOS) - { app::VKEY_F1, false, false, false, IDC_HELP_PAGE }, + { ui::VKEY_F1, false, false, false, IDC_HELP_PAGE }, #endif #if defined(OS_CHROMEOS) - { app::VKEY_OEM_2, false, true, false, IDC_HELP_PAGE }, - { app::VKEY_OEM_2, true, true, false, IDC_HELP_PAGE }, -#endif - { app::VKEY_I, true, true, false, IDC_DEV_TOOLS }, - { app::VKEY_J, true, true, false, IDC_DEV_TOOLS_CONSOLE }, - { app::VKEY_C, true, true, false, IDC_DEV_TOOLS_INSPECT }, - { app::VKEY_N, true, true, false, IDC_NEW_INCOGNITO_WINDOW }, - { app::VKEY_T, false, true, false, IDC_NEW_TAB }, - { app::VKEY_N, false, true, false, IDC_NEW_WINDOW }, - { app::VKEY_O, false, true, false, IDC_OPEN_FILE }, - { app::VKEY_P, false, true, false, IDC_PRINT}, - { app::VKEY_R, false, true, false, IDC_RELOAD }, - { app::VKEY_R, true, true, false, IDC_RELOAD_IGNORING_CACHE }, + { ui::VKEY_OEM_2, false, true, false, IDC_HELP_PAGE }, + { ui::VKEY_OEM_2, true, true, false, IDC_HELP_PAGE }, +#endif + { ui::VKEY_I, true, true, false, IDC_DEV_TOOLS }, + { ui::VKEY_J, true, true, false, IDC_DEV_TOOLS_CONSOLE }, + { ui::VKEY_C, true, true, false, IDC_DEV_TOOLS_INSPECT }, + { ui::VKEY_N, true, true, false, IDC_NEW_INCOGNITO_WINDOW }, + { ui::VKEY_T, false, true, false, IDC_NEW_TAB }, + { ui::VKEY_N, false, true, false, IDC_NEW_WINDOW }, + { ui::VKEY_O, false, true, false, IDC_OPEN_FILE }, + { ui::VKEY_P, false, true, false, IDC_PRINT}, + { ui::VKEY_R, false, true, false, IDC_RELOAD }, + { ui::VKEY_R, true, true, false, IDC_RELOAD_IGNORING_CACHE }, #if !defined(OS_CHROMEOS) - { app::VKEY_F5, false, false, false, IDC_RELOAD }, - { app::VKEY_F5, false, true, false, IDC_RELOAD_IGNORING_CACHE }, - { app::VKEY_F5, true, false, false, IDC_RELOAD_IGNORING_CACHE }, + { ui::VKEY_F5, false, false, false, IDC_RELOAD }, + { ui::VKEY_F5, false, true, false, IDC_RELOAD_IGNORING_CACHE }, + { ui::VKEY_F5, true, false, false, IDC_RELOAD_IGNORING_CACHE }, #endif #if defined(OS_CHROMEOS) - { app::VKEY_F3, false, false, false, IDC_RELOAD }, - { app::VKEY_F3, false, true, false, IDC_RELOAD_IGNORING_CACHE }, - { app::VKEY_F3, true, false, false, IDC_RELOAD_IGNORING_CACHE }, + { ui::VKEY_F3, false, false, false, IDC_RELOAD }, + { ui::VKEY_F3, false, true, false, IDC_RELOAD_IGNORING_CACHE }, + { ui::VKEY_F3, true, false, false, IDC_RELOAD_IGNORING_CACHE }, #endif - { app::VKEY_HOME, false, false, true, IDC_HOME }, - { app::VKEY_T, true, true, false, IDC_RESTORE_TAB }, - { app::VKEY_S, false, true, false, IDC_SAVE_PAGE }, + { ui::VKEY_HOME, false, false, true, IDC_HOME }, + { ui::VKEY_T, true, true, false, IDC_RESTORE_TAB }, + { ui::VKEY_S, false, true, false, IDC_SAVE_PAGE }, #if defined(OS_CHROMEOS) - { app::VKEY_LWIN, false, false, false, IDC_SEARCH }, -#endif - { app::VKEY_9, false, true, false, IDC_SELECT_LAST_TAB }, - { app::VKEY_NUMPAD9, false, true, false, IDC_SELECT_LAST_TAB }, - { app::VKEY_TAB, false, true, false, IDC_SELECT_NEXT_TAB }, - { app::VKEY_NEXT, false, true, false, IDC_SELECT_NEXT_TAB }, - { app::VKEY_TAB, true, true, false, IDC_SELECT_PREVIOUS_TAB }, - { app::VKEY_PRIOR, false, true, false, IDC_SELECT_PREVIOUS_TAB }, - { app::VKEY_1, false, true, false, IDC_SELECT_TAB_0 }, - { app::VKEY_NUMPAD1, false, true, false, IDC_SELECT_TAB_0 }, - { app::VKEY_2, false, true, false, IDC_SELECT_TAB_1 }, - { app::VKEY_NUMPAD2, false, true, false, IDC_SELECT_TAB_1 }, - { app::VKEY_3, false, true, false, IDC_SELECT_TAB_2 }, - { app::VKEY_NUMPAD3, false, true, false, IDC_SELECT_TAB_2 }, - { app::VKEY_4, false, true, false, IDC_SELECT_TAB_3 }, - { app::VKEY_NUMPAD4, false, true, false, IDC_SELECT_TAB_3 }, - { app::VKEY_5, false, true, false, IDC_SELECT_TAB_4 }, - { app::VKEY_NUMPAD5, false, true, false, IDC_SELECT_TAB_4 }, - { app::VKEY_6, false, true, false, IDC_SELECT_TAB_5 }, - { app::VKEY_NUMPAD6, false, true, false, IDC_SELECT_TAB_5 }, - { app::VKEY_7, false, true, false, IDC_SELECT_TAB_6 }, - { app::VKEY_NUMPAD7, false, true, false, IDC_SELECT_TAB_6 }, - { app::VKEY_8, false, true, false, IDC_SELECT_TAB_7 }, - { app::VKEY_NUMPAD8, false, true, false, IDC_SELECT_TAB_7 }, - { app::VKEY_B, true, true, false, IDC_SHOW_BOOKMARK_BAR }, - { app::VKEY_J, false, true, false, IDC_SHOW_DOWNLOADS }, - { app::VKEY_H, false, true, false, IDC_SHOW_HISTORY }, - { app::VKEY_F, false, false, true, IDC_SHOW_APP_MENU}, - { app::VKEY_E, false, false, true, IDC_SHOW_APP_MENU}, - { app::VKEY_ESCAPE, false, false, false, IDC_STOP }, - { app::VKEY_ESCAPE, true, false, false, IDC_TASK_MANAGER }, - { app::VKEY_U, false, true, false, IDC_VIEW_SOURCE }, - { app::VKEY_OEM_MINUS, false, true, false, IDC_ZOOM_MINUS }, - { app::VKEY_OEM_MINUS, true, true, false, IDC_ZOOM_MINUS }, - { app::VKEY_SUBTRACT, false, true, false, IDC_ZOOM_MINUS }, - { app::VKEY_0, false, true, false, IDC_ZOOM_NORMAL }, - { app::VKEY_NUMPAD0, false, true, false, IDC_ZOOM_NORMAL }, - { app::VKEY_OEM_PLUS, false, true, false, IDC_ZOOM_PLUS }, - { app::VKEY_OEM_PLUS, true, true, false, IDC_ZOOM_PLUS }, - { app::VKEY_ADD, false, true, false, IDC_ZOOM_PLUS }, + { ui::VKEY_LWIN, false, false, false, IDC_SEARCH }, +#endif + { ui::VKEY_9, false, true, false, IDC_SELECT_LAST_TAB }, + { ui::VKEY_NUMPAD9, false, true, false, IDC_SELECT_LAST_TAB }, + { ui::VKEY_TAB, false, true, false, IDC_SELECT_NEXT_TAB }, + { ui::VKEY_NEXT, false, true, false, IDC_SELECT_NEXT_TAB }, + { ui::VKEY_TAB, true, true, false, IDC_SELECT_PREVIOUS_TAB }, + { ui::VKEY_PRIOR, false, true, false, IDC_SELECT_PREVIOUS_TAB }, + { ui::VKEY_1, false, true, false, IDC_SELECT_TAB_0 }, + { ui::VKEY_NUMPAD1, false, true, false, IDC_SELECT_TAB_0 }, + { ui::VKEY_2, false, true, false, IDC_SELECT_TAB_1 }, + { ui::VKEY_NUMPAD2, false, true, false, IDC_SELECT_TAB_1 }, + { ui::VKEY_3, false, true, false, IDC_SELECT_TAB_2 }, + { ui::VKEY_NUMPAD3, false, true, false, IDC_SELECT_TAB_2 }, + { ui::VKEY_4, false, true, false, IDC_SELECT_TAB_3 }, + { ui::VKEY_NUMPAD4, false, true, false, IDC_SELECT_TAB_3 }, + { ui::VKEY_5, false, true, false, IDC_SELECT_TAB_4 }, + { ui::VKEY_NUMPAD5, false, true, false, IDC_SELECT_TAB_4 }, + { ui::VKEY_6, false, true, false, IDC_SELECT_TAB_5 }, + { ui::VKEY_NUMPAD6, false, true, false, IDC_SELECT_TAB_5 }, + { ui::VKEY_7, false, true, false, IDC_SELECT_TAB_6 }, + { ui::VKEY_NUMPAD7, false, true, false, IDC_SELECT_TAB_6 }, + { ui::VKEY_8, false, true, false, IDC_SELECT_TAB_7 }, + { ui::VKEY_NUMPAD8, false, true, false, IDC_SELECT_TAB_7 }, + { ui::VKEY_B, true, true, false, IDC_SHOW_BOOKMARK_BAR }, + { ui::VKEY_J, false, true, false, IDC_SHOW_DOWNLOADS }, + { ui::VKEY_H, false, true, false, IDC_SHOW_HISTORY }, + { ui::VKEY_F, false, false, true, IDC_SHOW_APP_MENU}, + { ui::VKEY_E, false, false, true, IDC_SHOW_APP_MENU}, + { ui::VKEY_ESCAPE, false, false, false, IDC_STOP }, + { ui::VKEY_ESCAPE, true, false, false, IDC_TASK_MANAGER }, + { ui::VKEY_U, false, true, false, IDC_VIEW_SOURCE }, + { ui::VKEY_OEM_MINUS, false, true, false, IDC_ZOOM_MINUS }, + { ui::VKEY_OEM_MINUS, true, true, false, IDC_ZOOM_MINUS }, + { ui::VKEY_SUBTRACT, false, true, false, IDC_ZOOM_MINUS }, + { ui::VKEY_0, false, true, false, IDC_ZOOM_NORMAL }, + { ui::VKEY_NUMPAD0, false, true, false, IDC_ZOOM_NORMAL }, + { ui::VKEY_OEM_PLUS, false, true, false, IDC_ZOOM_PLUS }, + { ui::VKEY_OEM_PLUS, true, true, false, IDC_ZOOM_PLUS }, + { ui::VKEY_ADD, false, true, false, IDC_ZOOM_PLUS }, }; const size_t kAcceleratorMapLength = arraysize(kAcceleratorMap); diff --git a/chrome/browser/ui/views/accelerator_table_gtk.h b/chrome/browser/ui/views/accelerator_table_gtk.h index 4b38144..865db16 100644 --- a/chrome/browser/ui/views/accelerator_table_gtk.h +++ b/chrome/browser/ui/views/accelerator_table_gtk.h @@ -8,14 +8,14 @@ #include <stdio.h> -#include "app/keyboard_codes.h" +#include "ui/base/keycodes/keyboard_codes.h" // This contains the list of accelerators for the Linux toolkit_view // implementation. namespace browser { struct AcceleratorMapping { - app::KeyboardCode keycode; + ui::KeyboardCode keycode; bool shift_pressed; bool ctrl_pressed; bool alt_pressed; diff --git a/chrome/browser/ui/views/accessible_pane_view.cc b/chrome/browser/ui/views/accessible_pane_view.cc index 1e07d1d..07b7a37 100644 --- a/chrome/browser/ui/views/accessible_pane_view.cc +++ b/chrome/browser/ui/views/accessible_pane_view.cc @@ -18,11 +18,11 @@ AccessiblePaneView::AccessiblePaneView() : pane_has_focus_(false), ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), focus_manager_(NULL), - home_key_(app::VKEY_HOME, false, false, false), - end_key_(app::VKEY_END, false, false, false), - escape_key_(app::VKEY_ESCAPE, false, false, false), - left_key_(app::VKEY_LEFT, false, false, false), - right_key_(app::VKEY_RIGHT, false, false, false), + home_key_(ui::VKEY_HOME, false, false, false), + end_key_(ui::VKEY_END, false, false, false), + escape_key_(ui::VKEY_ESCAPE, false, false, false), + left_key_(ui::VKEY_LEFT, false, false, false), + right_key_(ui::VKEY_RIGHT, false, false, false), last_focused_view_storage_id_(-1) { focus_search_.reset(new views::FocusSearch(this, true, true)); } @@ -161,21 +161,21 @@ bool AccessiblePaneView::AcceleratorPressed( } switch (accelerator.GetKeyCode()) { - case app::VKEY_ESCAPE: + case ui::VKEY_ESCAPE: RemovePaneFocus(); RestoreLastFocusedView(); return true; - case app::VKEY_LEFT: + case ui::VKEY_LEFT: focus_manager_->AdvanceFocus(true); return true; - case app::VKEY_RIGHT: + case ui::VKEY_RIGHT: focus_manager_->AdvanceFocus(false); return true; - case app::VKEY_HOME: + case ui::VKEY_HOME: focus_manager_->SetFocusedViewWithReason( GetFirstFocusableChild(), views::FocusManager::kReasonFocusTraversal); return true; - case app::VKEY_END: + case ui::VKEY_END: focus_manager_->SetFocusedViewWithReason( GetLastFocusableChild(), views::FocusManager::kReasonFocusTraversal); return true; diff --git a/chrome/browser/ui/views/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmark_bar_view_test.cc index bc1253c..b360363 100644 --- a/chrome/browser/ui/views/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmark_bar_view_test.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/keyboard_codes.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" @@ -20,6 +19,7 @@ #include "chrome/test/ui_test_utils.h" #include "grit/generated_resources.h" #include "ui/base/clipboard/clipboard.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/controls/button/menu_button.h" #include "views/controls/button/text_button.h" #include "views/controls/menu/menu_controller.h" @@ -882,7 +882,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a down event, which should select the first item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_DOWN, false, false, false, false, + NULL, ui::VKEY_DOWN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step3)); } @@ -895,7 +895,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a key down event, which should select the next item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_DOWN, false, false, false, false, + NULL, ui::VKEY_DOWN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step4)); } @@ -908,7 +908,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a right arrow to force the menu to open. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_RIGHT, false, false, false, false, + NULL, ui::VKEY_RIGHT, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step5)); } @@ -924,7 +924,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a left arrow to close the submenu. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_LEFT, false, false, false, false, + NULL, ui::VKEY_LEFT, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step6)); } @@ -939,7 +939,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a down arrow to wrap back to f1a ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_DOWN, false, false, false, false, + NULL, ui::VKEY_DOWN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step7)); } @@ -952,7 +952,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send enter, which should select the item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_RETURN, false, false, false, false, + NULL, ui::VKEY_RETURN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step8)); } @@ -1007,7 +1007,7 @@ class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { void Step3() { // Send escape so that the context menu hides. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_ESCAPE, false, false, false, false, + NULL, ui::VKEY_ESCAPE, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest11::Step4)); } @@ -1096,7 +1096,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { void Step4() { // Press tab to give focus to the cancel button. - ui_controls::SendKeyPress(NULL, app::VKEY_TAB, false, false, false, false); + ui_controls::SendKeyPress(NULL, ui::VKEY_TAB, false, false, false, false); // For some reason return isn't processed correctly unless we delay. MessageLoop::current()->PostDelayedTask(FROM_HERE, @@ -1106,7 +1106,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { void Step5() { // And press enter so that the cancel button is selected. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_RETURN, false, false, false, false, + NULL, ui::VKEY_RETURN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest12::Step6)); } @@ -1235,7 +1235,7 @@ class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { // Send escape so that the context menu hides. ui_controls::SendKeyPressNotifyWhenDone( - NULL, app::VKEY_ESCAPE, false, false, false, false, + NULL, ui::VKEY_ESCAPE, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest14::Step3)); } diff --git a/chrome/browser/ui/views/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmark_bubble_view.cc index 2f33f1f..1a6e3b6 100644 --- a/chrome/browser/ui/views/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmark_bubble_view.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/bookmark_bubble_view.h" -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/string16.h" @@ -22,6 +21,7 @@ #include "gfx/color_utils.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/event.h" #include "views/standard_layout.h" #include "views/controls/button/native_button.h" @@ -138,7 +138,7 @@ void BookmarkBubbleView::DidChangeBounds(const gfx::Rect& previous, void BookmarkBubbleView::BubbleShown() { DCHECK(GetWidget()); GetFocusManager()->RegisterAccelerator( - views::Accelerator(app::VKEY_RETURN, false, false, false), this); + views::Accelerator(ui::VKEY_RETURN, false, false, false), this); title_tf_->RequestFocus(); title_tf_->SelectAll(); @@ -146,7 +146,7 @@ void BookmarkBubbleView::BubbleShown() { bool BookmarkBubbleView::AcceleratorPressed( const views::Accelerator& accelerator) { - if (accelerator.GetKeyCode() != app::VKEY_RETURN) + if (accelerator.GetKeyCode() != ui::VKEY_RETURN) return false; if (edit_button_->HasFocus()) diff --git a/chrome/browser/ui/views/browser_keyboard_accessibility_test_win.cc b/chrome/browser/ui/views/browser_keyboard_accessibility_test_win.cc index 0c31a5b..adbeaaf 100644 --- a/chrome/browser/ui/views/browser_keyboard_accessibility_test_win.cc +++ b/chrome/browser/ui/views/browser_keyboard_accessibility_test_win.cc @@ -2,12 +2,12 @@ // 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 "chrome/browser/automation/ui_controls.h" #include "chrome/browser/ui/views/chrome_views_delegate.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/view.h" #include "views/accessibility/view_accessibility.h" #include "views/widget/widget.h" @@ -119,7 +119,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, // TODO(phajdan.jr): remove logging after fixing http://crbug.com/50663. LOG(ERROR) << "Sending TAB key event..."; ui_controls::SendKeyPressNotifyWhenDone(current_view_native_window(), - app::VKEY_TAB, + ui::VKEY_TAB, true, false, false, false, new MessageLoop::QuitTask()); set_waiting(true); @@ -153,7 +153,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyboardAccessibility, DISABLED_TabInToolbar) { gfx::NativeWindow native_window = browser()->window()->GetNativeHandle(); ui_controls::SendKeyPressNotifyWhenDone(native_window, - app::VKEY_T, + ui::VKEY_T, false, true, true, false, new MessageLoop::QuitTask()); set_waiting(true); @@ -197,7 +197,7 @@ void BrowserKeyboardAccessibility::TabCycler(gfx::NativeWindow hwnd, do { // TODO(phajdan.jr): remove logging after fixing http://crbug.com/50663. LOG(ERROR) << "Sending TAB key event."; - ui_controls::SendKeyPressNotifyWhenDone(hwnd, app::VKEY_TAB, + ui_controls::SendKeyPressNotifyWhenDone(hwnd, ui::VKEY_TAB, false, !forward_tab, false, false, new MessageLoop::QuitTask()); set_waiting(true); ui_test_utils::RunMessageLoop(); diff --git a/chrome/browser/ui/views/download_item_view.cc b/chrome/browser/ui/views/download_item_view.cc index d35725b..f09cb48 100644 --- a/chrome/browser/ui/views/download_item_view.cc +++ b/chrome/browser/ui/views/download_item_view.cc @@ -876,8 +876,8 @@ bool DownloadItemView::OnKeyPressed(const views::KeyEvent& e) { if (IsDangerousMode()) return true; - if (e.GetKeyCode() == app::VKEY_SPACE || - e.GetKeyCode() == app::VKEY_RETURN) { + if (e.GetKeyCode() == ui::VKEY_SPACE || + e.GetKeyCode() == ui::VKEY_RETURN) { OpenDownload(); return true; } diff --git a/chrome/browser/ui/views/dropdown_bar_host.cc b/chrome/browser/ui/views/dropdown_bar_host.cc index e181565f..7933b39 100644 --- a/chrome/browser/ui/views/dropdown_bar_host.cc +++ b/chrome/browser/ui/views/dropdown_bar_host.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/dropdown_bar_host.h" -#include "app/keyboard_codes.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/dropdown_bar_view.h" @@ -12,6 +11,7 @@ #include "gfx/path.h" #include "gfx/scrollbar_size.h" #include "ui/base/animation/slide_animation.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/focus/external_focus_tracker.h" #include "views/focus/view_storage.h" #include "views/widget/widget.h" @@ -305,14 +305,14 @@ void DropdownBarHost::UpdateWindowEdges(const gfx::Rect& new_pos) { void DropdownBarHost::RegisterAccelerators() { DCHECK(!esc_accel_target_registered_); - views::Accelerator escape(app::VKEY_ESCAPE, false, false, false); + views::Accelerator escape(ui::VKEY_ESCAPE, false, false, false); focus_manager_->RegisterAccelerator(escape, this); esc_accel_target_registered_ = true; } void DropdownBarHost::UnregisterAccelerators() { DCHECK(esc_accel_target_registered_); - views::Accelerator escape(app::VKEY_ESCAPE, false, false, false); + views::Accelerator escape(ui::VKEY_ESCAPE, false, false, false); focus_manager_->UnregisterAccelerator(escape, this); esc_accel_target_registered_ = false; } diff --git a/chrome/browser/ui/views/dropdown_bar_host_gtk.cc b/chrome/browser/ui/views/dropdown_bar_host_gtk.cc index 763caa4..022a201 100644 --- a/chrome/browser/ui/views/dropdown_bar_host_gtk.cc +++ b/chrome/browser/ui/views/dropdown_bar_host_gtk.cc @@ -12,7 +12,7 @@ #include "views/controls/textfield/textfield.h" #if defined(TOUCH_UI) -#include "app/keyboard_code_conversion_gtk.h" +#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" #endif views::Widget* DropdownBarHost::CreateHost() { diff --git a/chrome/browser/ui/views/dropdown_bar_host_win.cc b/chrome/browser/ui/views/dropdown_bar_host_win.cc index 99d12a9..f08db1d 100644 --- a/chrome/browser/ui/views/dropdown_bar_host_win.cc +++ b/chrome/browser/ui/views/dropdown_bar_host_win.cc @@ -4,12 +4,12 @@ #include "chrome/browser/ui/views/dropdown_bar_host.h" -#include "app/keyboard_code_conversion_win.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "ui/base/keycodes/keyboard_code_conversion_win.h" #include "views/controls/scrollbar/native_scroll_bar.h" #include "views/widget/widget_win.h" diff --git a/chrome/browser/ui/views/extensions/extension_view.cc b/chrome/browser/ui/views/extensions/extension_view.cc index f34b6ad..8fc7cde 100644 --- a/chrome/browser/ui/views/extensions/extension_view.cc +++ b/chrome/browser/ui/views/extensions/extension_view.cc @@ -180,7 +180,7 @@ void ExtensionView::PreferredSizeChanged() { bool ExtensionView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { // Let the tab key event be processed by the renderer (instead of moving the // focus to the next focusable view). - return (e.GetKeyCode() == app::VKEY_TAB); + return (e.GetKeyCode() == ui::VKEY_TAB); } void ExtensionView::HandleMouseMove() { diff --git a/chrome/browser/ui/views/find_bar_host.cc b/chrome/browser/ui/views/find_bar_host.cc index ba2de8e..bfd74e3 100644 --- a/chrome/browser/ui/views/find_bar_host.cc +++ b/chrome/browser/ui/views/find_bar_host.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/find_bar_host.h" -#include "app/keyboard_codes.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" @@ -13,6 +12,7 @@ #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/find_bar_view.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/focus/external_focus_tracker.h" #include "views/focus/view_storage.h" #include "views/widget/root_view.h" @@ -47,13 +47,13 @@ bool FindBarHost::MaybeForwardKeyEventToWebpage( } switch (key_event.GetKeyCode()) { - case app::VKEY_DOWN: - case app::VKEY_UP: - case app::VKEY_PRIOR: - case app::VKEY_NEXT: + case ui::VKEY_DOWN: + case ui::VKEY_UP: + case ui::VKEY_PRIOR: + case ui::VKEY_NEXT: break; - case app::VKEY_HOME: - case app::VKEY_END: + case ui::VKEY_HOME: + case ui::VKEY_END: if (key_event.IsControlDown()) break; // Fall through. @@ -164,11 +164,11 @@ FindBarTesting* FindBarHost::GetFindBarTesting() { // FindBarWin, views::AcceleratorTarget implementation: bool FindBarHost::AcceleratorPressed(const views::Accelerator& accelerator) { - app::KeyboardCode key = accelerator.GetKeyCode(); - if (key == app::VKEY_RETURN && accelerator.IsCtrlDown()) { + ui::KeyboardCode key = accelerator.GetKeyCode(); + if (key == ui::VKEY_RETURN && accelerator.IsCtrlDown()) { // Ctrl+Enter closes the Find session and navigates any link that is active. find_bar_controller_->EndFindSession(FindBarController::kActivateSelection); - } else if (key == app::VKEY_ESCAPE) { + } else if (key == ui::VKEY_ESCAPE) { // This will end the Find session and hide the window, causing it to loose // focus and in the process unregister us as the handler for the Escape // accelerator through the FocusWillChange event. @@ -288,13 +288,13 @@ void FindBarHost::RegisterAccelerators() { DropdownBarHost::RegisterAccelerators(); // Register for Ctrl+Return. - views::Accelerator escape(app::VKEY_RETURN, false, true, false); + views::Accelerator escape(ui::VKEY_RETURN, false, true, false); focus_manager()->RegisterAccelerator(escape, this); } void FindBarHost::UnregisterAccelerators() { // Unregister Ctrl+Return. - views::Accelerator escape(app::VKEY_RETURN, false, true, false); + views::Accelerator escape(ui::VKEY_RETURN, false, true, false); focus_manager()->UnregisterAccelerator(escape, this); DropdownBarHost::UnregisterAccelerators(); diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index cb3d364..8a3c402 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/keyboard_codes.h" #include "base/process_util.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -16,6 +15,7 @@ #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "net/test/test_server.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/focus/focus_manager.h" #include "views/view.h" @@ -73,7 +73,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) { // This used to crash until bug 1303709 was fixed. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_ESCAPE, false, false, false, false)); + browser(), ui::VKEY_ESCAPE, false, false, false, false)); } IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) { @@ -192,21 +192,21 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, PrepopulateRespectBlank) { // Search for "a". ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_A, false, false, false, false)); + browser(), ui::VKEY_A, false, false, false, false)); // We should find "a" here. EXPECT_EQ(ASCIIToUTF16("a"), GetFindBarText()); // Delete "a". ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_BACK, false, false, false, false)); + browser(), ui::VKEY_BACK, false, false, false, false)); // Validate we have cleared the text. EXPECT_EQ(string16(), GetFindBarText()); // Close the Find box. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_ESCAPE, false, false, false, false)); + browser(), ui::VKEY_ESCAPE, false, false, false, false)); // Show the Find bar. browser()->GetFindBarController()->Show(); @@ -217,11 +217,11 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, PrepopulateRespectBlank) { // Close the Find box. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_ESCAPE, false, false, false, false)); + browser(), ui::VKEY_ESCAPE, false, false, false, false)); // Press F3 to trigger FindNext. ASSERT_TRUE(ui_test_utils::SendKeyPressSync( - browser(), app::VKEY_F3, false, false, false, false)); + browser(), ui::VKEY_F3, false, false, false, false)); // After the Find box has been reopened, it should still have no prepopulate // value. diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index 5b643fd..4272634 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -512,7 +512,7 @@ bool FindBarView::HandleKeyEvent(views::Textfield* sender, if (find_bar_host()->MaybeForwardKeyEventToWebpage(key_event)) return true; // Handled, we are done! - if (key_event.GetKeyCode() == app::VKEY_RETURN) { + if (key_event.GetKeyCode() == ui::VKEY_RETURN) { // Pressing Return/Enter starts the search (unless text box is empty). string16 find_string = find_text_->text(); if (!find_string.empty()) { diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index a52745b..4ba5d41 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -620,13 +620,13 @@ bool BrowserView::GetAccelerator(int cmd_id, menus::Accelerator* accelerator) { // anywhere so we need to check for them explicitly here. switch (cmd_id) { case IDC_CUT: - *accelerator = views::Accelerator(app::VKEY_X, false, true, false); + *accelerator = views::Accelerator(ui::VKEY_X, false, true, false); return true; case IDC_COPY: - *accelerator = views::Accelerator(app::VKEY_C, false, true, false); + *accelerator = views::Accelerator(ui::VKEY_C, false, true, false); return true; case IDC_PASTE: - *accelerator = views::Accelerator(app::VKEY_V, false, true, false); + *accelerator = views::Accelerator(ui::VKEY_V, false, true, false); return true; } // Else, we retrieve the accelerator information from the accelerator table. @@ -1213,7 +1213,7 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, #if defined(OS_WIN) // As Alt+F4 is the close-app keyboard shortcut, it needs processing // immediately. - if (event.windowsKeyCode == app::VKEY_F4 && + if (event.windowsKeyCode == ui::VKEY_F4 && event.modifiers == NativeWebKeyboardEvent::AltKey) { DefWindowProc(event.os_event.hwnd, event.os_event.message, event.os_event.wParam, event.os_event.lParam); @@ -1238,7 +1238,7 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, views_event.IsAltDown()); #else views::Accelerator accelerator( - static_cast<app::KeyboardCode>(event.windowsKeyCode), + static_cast<ui::KeyboardCode>(event.windowsKeyCode), (event.modifiers & NativeWebKeyboardEvent::ShiftKey) == NativeWebKeyboardEvent::ShiftKey, (event.modifiers & NativeWebKeyboardEvent::ControlKey) == @@ -1306,34 +1306,34 @@ void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { // manager to do that. #if !defined(OS_MACOSX) void BrowserView::Cut() { - ui_controls::SendKeyPress(GetNativeHandle(), app::VKEY_X, + ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_X, true, false, false, false); } void BrowserView::Copy() { - ui_controls::SendKeyPress(GetNativeHandle(), app::VKEY_C, + ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_C, true, false, false, false); } void BrowserView::Paste() { - ui_controls::SendKeyPress(GetNativeHandle(), app::VKEY_V, + ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_V, true, false, false, false); } #else // Mac versions. Not tested by antyhing yet; // don't assume written == works. void BrowserView::Cut() { - ui_controls::SendKeyPress(GetNativeHandle(), app::VKEY_X, + ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_X, false, false, false, true); } void BrowserView::Copy() { - ui_controls::SendKeyPress(GetNativeHandle(), app::VKEY_C, + ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_C, false, false, false, true); } void BrowserView::Paste() { - ui_controls::SendKeyPress(GetNativeHandle(), app::VKEY_V, + ui_controls::SendKeyPress(GetNativeHandle(), ui::VKEY_V, false, false, false, true); } #endif @@ -2289,7 +2289,7 @@ void BrowserView::LoadAccelerators() { bool ctrl_down = (accelerators[i].fVirt & FCONTROL) == FCONTROL; bool shift_down = (accelerators[i].fVirt & FSHIFT) == FSHIFT; views::Accelerator accelerator( - static_cast<app::KeyboardCode>(accelerators[i].key), + static_cast<ui::KeyboardCode>(accelerators[i].key), shift_down, ctrl_down, alt_down); accelerator_table_[accelerator] = accelerators[i].cmd; @@ -2448,53 +2448,53 @@ void BrowserView::UpdateAcceleratorMetrics( #if defined(OS_CHROMEOS) // Collect information about the relative popularity of various accelerators // on Chrome OS. - const app::KeyboardCode key_code = accelerator.GetKeyCode(); + const ui::KeyboardCode key_code = accelerator.GetKeyCode(); switch (command_id) { case IDC_BACK: - if (key_code == app::VKEY_BACK) + if (key_code == ui::VKEY_BACK) UserMetrics::RecordAction(UserMetricsAction("Accel_Back_Backspace")); - else if (key_code == app::VKEY_F1) + else if (key_code == ui::VKEY_F1) UserMetrics::RecordAction(UserMetricsAction("Accel_Back_F1")); - else if (key_code == app::VKEY_LEFT) + else if (key_code == ui::VKEY_LEFT) UserMetrics::RecordAction(UserMetricsAction("Accel_Back_Left")); break; case IDC_FORWARD: - if (key_code == app::VKEY_BACK) + if (key_code == ui::VKEY_BACK) UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_Backspace")); - else if (key_code == app::VKEY_F2) + else if (key_code == ui::VKEY_F2) UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_F2")); - else if (key_code == app::VKEY_LEFT) + else if (key_code == ui::VKEY_LEFT) UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_Right")); break; case IDC_RELOAD: case IDC_RELOAD_IGNORING_CACHE: - if (key_code == app::VKEY_R) + if (key_code == ui::VKEY_R) UserMetrics::RecordAction(UserMetricsAction("Accel_Reload_R")); - else if (key_code == app::VKEY_F3) + else if (key_code == ui::VKEY_F3) UserMetrics::RecordAction(UserMetricsAction("Accel_Reload_F3")); break; case IDC_FULLSCREEN: - if (key_code == app::VKEY_F4) + if (key_code == ui::VKEY_F4) UserMetrics::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); break; case IDC_NEW_TAB: - if (key_code == app::VKEY_T) + if (key_code == ui::VKEY_T) UserMetrics::RecordAction(UserMetricsAction("Accel_NewTab_T")); break; case IDC_SEARCH: - if (key_code == app::VKEY_LWIN) + if (key_code == ui::VKEY_LWIN) UserMetrics::RecordAction(UserMetricsAction("Accel_Search_LWin")); break; case IDC_FOCUS_LOCATION: - if (key_code == app::VKEY_D) + if (key_code == ui::VKEY_D) UserMetrics::RecordAction(UserMetricsAction("Accel_FocusLocation_D")); - else if (key_code == app::VKEY_L) + else if (key_code == ui::VKEY_L) UserMetrics::RecordAction(UserMetricsAction("Accel_FocusLocation_L")); break; case IDC_FOCUS_SEARCH: - if (key_code == app::VKEY_E) + if (key_code == ui::VKEY_E) UserMetrics::RecordAction(UserMetricsAction("Accel_FocusSearch_E")); - else if (key_code == app::VKEY_K) + else if (key_code == ui::VKEY_K) UserMetrics::RecordAction(UserMetricsAction("Accel_FocusSearch_K")); break; default: diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc index d3f3910..2e59e6b 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/fullscreen_exit_bubble.h" -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/utf_string_conversions.h" @@ -12,6 +11,7 @@ #include "gfx/canvas_skia.h" #include "grit/generated_resources.h" #include "ui/base/animation/slide_animation.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/screen.h" #include "views/widget/root_view.h" #include "views/window/window.h" @@ -147,7 +147,7 @@ FullscreenExitBubble::FullscreenExitBubble( size_animation_->Reset(1); // Create the contents view. - views::Accelerator accelerator(app::VKEY_UNKNOWN, false, false, false); + views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); bool got_accelerator = frame->GetAccelerator(IDC_FULLSCREEN, &accelerator); DCHECK(got_accelerator); view_ = new FullscreenExitView( diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc index dd5c50a..32de496 100644 --- a/chrome/browser/ui/views/html_dialog_view.cc +++ b/chrome/browser/ui/views/html_dialog_view.cc @@ -4,11 +4,11 @@ #include "chrome/browser/ui/views/html_dialog_view.h" -#include "app/keyboard_codes.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/window.h" #include "chrome/common/native_web_keyboard_event.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" #include "views/window/window.h" @@ -56,7 +56,7 @@ gfx::Size HtmlDialogView::GetPreferredSize() { bool HtmlDialogView::AcceleratorPressed(const views::Accelerator& accelerator) { // Pressing ESC closes the dialog. - DCHECK_EQ(app::VKEY_ESCAPE, accelerator.GetKeyCode()); + DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.GetKeyCode()); OnDialogClosed(std::string()); return true; } @@ -214,7 +214,7 @@ void HtmlDialogView::InitDialog() { this); // Pressing the ESC key will close the dialog. - AddAccelerator(views::Accelerator(app::VKEY_ESCAPE, false, false, false)); + AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); DOMView::LoadURL(GetDialogContentURL()); } diff --git a/chrome/browser/ui/views/info_bubble.cc b/chrome/browser/ui/views/info_bubble.cc index bb296f8..409d663 100644 --- a/chrome/browser/ui/views/info_bubble.cc +++ b/chrome/browser/ui/views/info_bubble.cc @@ -6,7 +6,6 @@ #include <vector> -#include "app/keyboard_codes.h" #include "chrome/browser/ui/window_sizer.h" #include "chrome/common/notification_service.h" #include "gfx/canvas_skia.h" @@ -14,6 +13,7 @@ #include "gfx/path.h" #include "third_party/skia/include/core/SkPaint.h" #include "ui/base/animation/slide_animation.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/fill_layout.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -449,7 +449,7 @@ void InfoBubble::Init(views::Widget* parent, // Register the Escape accelerator for closing. GetFocusManager()->RegisterAccelerator( - views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); + views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); // Done creating the bubble. NotificationService::current()->Notify(NotificationType::INFO_BUBBLE_CREATED, @@ -514,7 +514,7 @@ void InfoBubble::DoClose(bool closed_by_escape) { return; GetFocusManager()->UnregisterAccelerator( - views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); + views::Accelerator(ui::VKEY_ESCAPE, false, false, false), this); if (delegate_) delegate_->InfoBubbleClosing(this, closed_by_escape); show_status_ = kClosed; diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc index 429b442..8d95f14 100644 --- a/chrome/browser/ui/views/js_modal_dialog_views.cc +++ b/chrome/browser/ui/views/js_modal_dialog_views.cc @@ -4,13 +4,13 @@ #include "chrome/browser/ui/views/js_modal_dialog_views.h" -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/message_box_flags.h" #include "base/utf_string_conversions.h" #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" #include "chrome/browser/ui/views/window.h" #include "grit/generated_resources.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/controls/message_box_view.h" #include "views/window/window.h" @@ -26,7 +26,7 @@ JSModalDialogViews::JSModalDialogViews( DCHECK(message_box_view_); message_box_view_->AddAccelerator( - views::Accelerator(app::VKEY_C, false, true, false)); + views::Accelerator(ui::VKEY_C, false, true, false)); if (parent->display_suppress_checkbox()) { message_box_view_->SetCheckBoxLabel(UTF16ToWide( l10n_util::GetStringUTF16(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION))); diff --git a/chrome/browser/ui/views/keyword_editor_view.cc b/chrome/browser/ui/views/keyword_editor_view.cc index 2899495..9e3ec7c 100644 --- a/chrome/browser/ui/views/keyword_editor_view.cc +++ b/chrome/browser/ui/views/keyword_editor_view.cc @@ -170,7 +170,7 @@ void KeywordEditorView::Init() { l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON))); add_button_->SetEnabled(controller_->loaded()); add_button_->AddAccelerator( - views::Accelerator(app::VKEY_A, false, false, true)); + views::Accelerator(ui::VKEY_A, false, false, true)); add_button_->SetAccessibleKeyboardShortcut(L"A"); edit_button_ = new views::NativeButton(this, UTF16ToWide( @@ -181,7 +181,7 @@ void KeywordEditorView::Init() { l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON))); remove_button_->SetEnabled(false); remove_button_->AddAccelerator( - views::Accelerator(app::VKEY_R, false, false, true)); + views::Accelerator(ui::VKEY_R, false, false, true)); remove_button_->SetAccessibleKeyboardShortcut(L"R"); make_default_button_ = new views::NativeButton( diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc index 1156a6d..1612cf9 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc @@ -139,8 +139,8 @@ void PageActionImageView::OnMouseReleased(const views::MouseEvent& event, } bool PageActionImageView::OnKeyPressed(const views::KeyEvent& e) { - if (e.GetKeyCode() == app::VKEY_SPACE || - e.GetKeyCode() == app::VKEY_RETURN) { + if (e.GetKeyCode() == ui::VKEY_SPACE || + e.GetKeyCode() == ui::VKEY_RETURN) { ExecuteAction(1, false); return true; } diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc index a52b1b6..2272810 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc @@ -59,8 +59,8 @@ void StarView::OnMouseReleased(const views::MouseEvent& event, bool canceled) { } bool StarView::OnKeyPressed(const views::KeyEvent& e) { - if (e.GetKeyCode() == app::VKEY_SPACE || - e.GetKeyCode() == app::VKEY_RETURN) { + if (e.GetKeyCode() == ui::VKEY_SPACE || + e.GetKeyCode() == ui::VKEY_RETURN) { command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); return true; } diff --git a/chrome/browser/ui/views/options/cookies_view.cc b/chrome/browser/ui/views/options/cookies_view.cc index cf436d0..64d79f5 100644 --- a/chrome/browser/ui/views/options/cookies_view.cc +++ b/chrome/browser/ui/views/options/cookies_view.cc @@ -146,9 +146,9 @@ void CookiesView::ContentsChanged(views::Textfield* sender, bool CookiesView::HandleKeyEvent(views::Textfield* sender, const views::KeyEvent& key_event) { - if (key_event.GetKeyCode() == app::VKEY_ESCAPE) { + if (key_event.GetKeyCode() == ui::VKEY_ESCAPE) { ResetSearchQuery(); - } else if (key_event.GetKeyCode() == app::VKEY_RETURN) { + } else if (key_event.GetKeyCode() == ui::VKEY_RETURN) { search_update_factory_.RevokeAll(); UpdateSearchResults(); } @@ -241,8 +241,8 @@ void CookiesView::OnTreeViewSelectionChanged(views::TreeView* tree_view) { } } -void CookiesView::OnTreeViewKeyDown(app::KeyboardCode keycode) { - if (keycode == app::VKEY_DELETE) +void CookiesView::OnTreeViewKeyDown(ui::KeyboardCode keycode) { + if (keycode == ui::VKEY_DELETE) cookies_tree_->RemoveSelectedItems(); } diff --git a/chrome/browser/ui/views/options/cookies_view.h b/chrome/browser/ui/views/options/cookies_view.h index af0d9ec..fbc8821 100644 --- a/chrome/browser/ui/views/options/cookies_view.h +++ b/chrome/browser/ui/views/options/cookies_view.h @@ -72,7 +72,7 @@ class CookiesView : public CookiesTreeModel::Observer, virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); // views::TreeViewController implementation. - virtual void OnTreeViewKeyDown(app::KeyboardCode keycode); + virtual void OnTreeViewKeyDown(ui::KeyboardCode keycode); // views::Textfield::Controller implementation. virtual void ContentsChanged(views::Textfield* sender, diff --git a/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc index a5ad31d..42a05e9 100644 --- a/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc +++ b/chrome/browser/ui/views/tab_contents/render_view_context_menu_views.cc @@ -4,10 +4,10 @@ #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h" -#include "app/keyboard_codes.h" #include "base/logging.h" #include "chrome/app/chrome_command_ids.h" #include "grit/generated_resources.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/accelerator.h" #include "views/controls/menu/menu_2.h" @@ -67,28 +67,28 @@ bool RenderViewContextMenuViews::GetAcceleratorForCommandId( // that Ctrl+C, Ctrl+V, Ctrl+X, Ctrl-A, etc do what they normally do. switch (command_id) { case IDC_CONTENT_CONTEXT_UNDO: - *accel = views::Accelerator(app::VKEY_Z, false, true, false); + *accel = views::Accelerator(ui::VKEY_Z, false, true, false); return true; case IDC_CONTENT_CONTEXT_REDO: // TODO(jcampan): should it be Ctrl-Y? - *accel = views::Accelerator(app::VKEY_Z, true, true, false); + *accel = views::Accelerator(ui::VKEY_Z, true, true, false); return true; case IDC_CONTENT_CONTEXT_CUT: - *accel = views::Accelerator(app::VKEY_X, false, true, false); + *accel = views::Accelerator(ui::VKEY_X, false, true, false); return true; case IDC_CONTENT_CONTEXT_COPY: - *accel = views::Accelerator(app::VKEY_C, false, true, false); + *accel = views::Accelerator(ui::VKEY_C, false, true, false); return true; case IDC_CONTENT_CONTEXT_PASTE: - *accel = views::Accelerator(app::VKEY_V, false, true, false); + *accel = views::Accelerator(ui::VKEY_V, false, true, false); return true; case IDC_CONTENT_CONTEXT_SELECTALL: - *accel = views::Accelerator(app::VKEY_A, false, true, false); + *accel = views::Accelerator(ui::VKEY_A, false, true, false); return true; default: diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc index 4953308..e12dd20 100644 --- a/chrome/browser/ui/views/task_manager_view.cc +++ b/chrome/browser/ui/views/task_manager_view.cc @@ -233,7 +233,7 @@ class TaskManagerView : public views::View, // views::TableViewObserver implementation. virtual void OnSelectionChanged(); virtual void OnDoubleClick(); - virtual void OnKeyDown(app::KeyboardCode keycode); + virtual void OnKeyDown(ui::KeyboardCode keycode); // views::LinkController implementation. virtual void LinkActivated(views::Link* source, int event_flags); @@ -384,7 +384,7 @@ void TaskManagerView::Init() { } kill_button_ = new views::NativeButton( this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_KILL))); - kill_button_->AddAccelerator(views::Accelerator(app::VKEY_E, + kill_button_->AddAccelerator(views::Accelerator(ui::VKEY_E, false, false, false)); kill_button_->SetAccessibleKeyboardShortcut(L"E"); about_memory_link_ = new views::Link(UTF16ToWide( @@ -600,8 +600,8 @@ void TaskManagerView::OnDoubleClick() { ActivateFocusedTab(); } -void TaskManagerView::OnKeyDown(app::KeyboardCode keycode) { - if (keycode == app::VKEY_RETURN) +void TaskManagerView::OnKeyDown(ui::KeyboardCode keycode) { + if (keycode == ui::VKEY_RETURN) ActivateFocusedTab(); } diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index dca962e..38ab6e5 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -460,13 +460,13 @@ bool ToolbarView::GetAcceleratorForCommandId(int command_id, // TODO(cpu) Bug 1109102. Query WebKit land for the actual bindings. switch (command_id) { case IDC_CUT: - *accelerator = views::Accelerator(app::VKEY_X, false, true, false); + *accelerator = views::Accelerator(ui::VKEY_X, false, true, false); return true; case IDC_COPY: - *accelerator = views::Accelerator(app::VKEY_C, false, true, false); + *accelerator = views::Accelerator(ui::VKEY_C, false, true, false); return true; case IDC_PASTE: - *accelerator = views::Accelerator(app::VKEY_V, false, true, false); + *accelerator = views::Accelerator(ui::VKEY_V, false, true, false); return true; } // Else, we retrieve the accelerator information from the frame. diff --git a/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc b/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc index b31b9f6..02eda65 100644 --- a/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc +++ b/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc @@ -34,7 +34,7 @@ void UnhandledKeyboardEventHandler::HandleKeyboardEvent( if (event.type == WebKit::WebInputEvent::RawKeyDown) { views::Accelerator accelerator( - static_cast<app::KeyboardCode>(event.windowsKeyCode), + static_cast<ui::KeyboardCode>(event.windowsKeyCode), (event.modifiers & NativeWebKeyboardEvent::ShiftKey) == NativeWebKeyboardEvent::ShiftKey, (event.modifiers & NativeWebKeyboardEvent::ControlKey) == diff --git a/chrome/browser/ui/views/url_picker.cc b/chrome/browser/ui/views/url_picker.cc index e020de3..b7bfd0e 100644 --- a/chrome/browser/ui/views/url_picker.cc +++ b/chrome/browser/ui/views/url_picker.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/url_picker.h" -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/table_model.h" @@ -20,6 +19,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "net/base/net_util.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/background.h" #include "views/controls/label.h" #include "views/controls/table/table_view.h" @@ -113,7 +113,7 @@ UrlPicker::UrlPicker(UrlPickerDelegate* delegate, layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); - AddAccelerator(views::Accelerator(app::VKEY_RETURN, false, false, false)); + AddAccelerator(views::Accelerator(ui::VKEY_RETURN, false, false, false)); } UrlPicker::~UrlPicker() { diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h index 23249da..ac3fd77 100644 --- a/chrome/common/automation_messages_internal.h +++ b/chrome/common/automation_messages_internal.h @@ -364,7 +364,7 @@ IPC_MESSAGE_CONTROL3(AutomationMsg_WindowClick, // This message requests that a key press be performed. // Request: // int - the handle of the window that's the context for this click -// int - the app::KeyboardCode of the key that was pressed. +// int - the ui::KeyboardCode of the key that was pressed. // int - the flags which identify the modifiers (shift, ctrl, alt) // associated for, as defined in chrome/views/event.h IPC_MESSAGE_CONTROL3(AutomationMsg_WindowKeyPress, diff --git a/chrome/renderer/autofill_helper.cc b/chrome/renderer/autofill_helper.cc index 092555f..b383504 100644 --- a/chrome/renderer/autofill_helper.cc +++ b/chrome/renderer/autofill_helper.cc @@ -4,7 +4,6 @@ #include "chrome/renderer/autofill_helper.h" -#include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "base/utf_string_conversions.h" #include "chrome/common/chrome_constants.h" @@ -16,6 +15,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" #include "webkit/glue/password_form.h" @@ -219,8 +219,8 @@ void AutoFillHelper::TextDidChangeInTextField(const WebInputElement& element) { void AutoFillHelper::KeyDownInTextField(const WebInputElement& element, const WebKeyboardEvent& event) { - if (event.windowsKeyCode == app::VKEY_DOWN || - event.windowsKeyCode == app::VKEY_UP) + if (event.windowsKeyCode == ui::VKEY_DOWN || + event.windowsKeyCode == ui::VKEY_UP) ShowSuggestions(element, true, true, true); } diff --git a/chrome/renderer/password_autocomplete_manager.cc b/chrome/renderer/password_autocomplete_manager.cc index 613a0b4..a18f9b8 100644 --- a/chrome/renderer/password_autocomplete_manager.cc +++ b/chrome/renderer/password_autocomplete_manager.cc @@ -4,7 +4,6 @@ #include "chrome/renderer/password_autocomplete_manager.h" -#include "app/keyboard_codes.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "chrome/common/render_messages.h" @@ -17,6 +16,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/form_field.h" #include "webkit/glue/password_form.h" #include "webkit/glue/password_form_dom_manager.h" @@ -303,7 +303,7 @@ void PasswordAutocompleteManager::TextFieldHandlingKeyDown( int win_key_code = event.windowsKeyCode; iter->second.backspace_pressed_last = - (win_key_code == app::VKEY_BACK || win_key_code == app::VKEY_DELETE); + (win_key_code == ui::VKEY_BACK || win_key_code == ui::VKEY_DELETE); } bool PasswordAutocompleteManager::FillPassword( diff --git a/chrome/renderer/password_autocomplete_manager_unittest.cc b/chrome/renderer/password_autocomplete_manager_unittest.cc index 453441a..fd6546f 100644 --- a/chrome/renderer/password_autocomplete_manager_unittest.cc +++ b/chrome/renderer/password_autocomplete_manager_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/keyboard_codes.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/renderer/password_autocomplete_manager.h" @@ -15,6 +14,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" @@ -124,7 +124,7 @@ class PasswordAutocompleteManagerTest : public RenderViewTest { } void SimulateKeyDownEvent(const WebInputElement& element, - app::KeyboardCode key_code) { + ui::KeyboardCode key_code) { WebKit::WebKeyboardEvent key_event; key_event.windowsKeyCode = key_code; view_->textFieldDidReceiveKeyDown(element, key_event); @@ -280,12 +280,12 @@ TEST_F(PasswordAutocompleteManagerTest, InlineAutocomplete) { CheckUsernameSelection(2, 5); // Test that deleting does not trigger autocomplete. - SimulateKeyDownEvent(username_element_, app::VKEY_BACK); + SimulateKeyDownEvent(username_element_, ui::VKEY_BACK); SimulateUsernameChange("alic", true); CheckTextFieldsState("alic", false, "", false); CheckUsernameSelection(4, 4); // No selection. // Reset the last pressed key to something other than backspace. - SimulateKeyDownEvent(username_element_, app::VKEY_A); + SimulateKeyDownEvent(username_element_, ui::VKEY_A); // Now lets say the user goes astray from the stored username and types the // letter 'f', spelling 'alf'. We don't know alf (that's just sad), so in diff --git a/chrome/renderer/render_view_browsertest.cc b/chrome/renderer/render_view_browsertest.cc index ad145e7..379407d 100644 --- a/chrome/renderer/render_view_browsertest.cc +++ b/chrome/renderer/render_view_browsertest.cc @@ -4,7 +4,6 @@ #include "base/basictypes.h" -#include "app/keyboard_codes.h" #include "base/file_util.h" #include "base/shared_memory.h" #include "base/string_util.h" @@ -25,6 +24,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" #include "webkit/glue/web_io_operators.h" @@ -643,20 +643,20 @@ TEST_F(RenderViewTest, OnHandleKeyboardEvent) { 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - app::VKEY_OEM_1, - app::VKEY_OEM_PLUS, - app::VKEY_OEM_COMMA, - app::VKEY_OEM_MINUS, - app::VKEY_OEM_PERIOD, - app::VKEY_OEM_2, - app::VKEY_OEM_3, - app::VKEY_OEM_4, - app::VKEY_OEM_5, - app::VKEY_OEM_6, - app::VKEY_OEM_7, + ui::VKEY_OEM_1, + ui::VKEY_OEM_PLUS, + ui::VKEY_OEM_COMMA, + ui::VKEY_OEM_MINUS, + ui::VKEY_OEM_PERIOD, + ui::VKEY_OEM_2, + ui::VKEY_OEM_3, + ui::VKEY_OEM_4, + ui::VKEY_OEM_5, + ui::VKEY_OEM_6, + ui::VKEY_OEM_7, #if defined(OS_WIN) // Not sure how to handle this key on Linux. - app::VKEY_OEM_8, + ui::VKEY_OEM_8, #endif }; @@ -884,20 +884,20 @@ TEST_F(RenderViewTest, InsertCharacters) { 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - app::VKEY_OEM_1, - app::VKEY_OEM_PLUS, - app::VKEY_OEM_COMMA, - app::VKEY_OEM_MINUS, - app::VKEY_OEM_PERIOD, - app::VKEY_OEM_2, - app::VKEY_OEM_3, - app::VKEY_OEM_4, - app::VKEY_OEM_5, - app::VKEY_OEM_6, - app::VKEY_OEM_7, + ui::VKEY_OEM_1, + ui::VKEY_OEM_PLUS, + ui::VKEY_OEM_COMMA, + ui::VKEY_OEM_MINUS, + ui::VKEY_OEM_PERIOD, + ui::VKEY_OEM_2, + ui::VKEY_OEM_3, + ui::VKEY_OEM_4, + ui::VKEY_OEM_5, + ui::VKEY_OEM_6, + ui::VKEY_OEM_7, #if defined(OS_WIN) // Unclear how to handle this on Linux. - app::VKEY_OEM_8, + ui::VKEY_OEM_8, #endif }; diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index e4293ce..93731b1 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -6,7 +6,6 @@ #include <string> #include <vector> -#include "app/keyboard_codes.h" #include "base/command_line.h" #include "base/environment.h" #include "base/file_util.h" @@ -32,6 +31,7 @@ #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" #include "googleurl/src/gurl.h" +#include "ui/base/keycodes/keyboard_codes.h" #if defined(TOOLKIT_VIEWS) #include "views/view.h" @@ -487,35 +487,35 @@ bool AutomatedUITest::Options() { } bool AutomatedUITest::PressDownArrow() { - return SimulateKeyPressInActiveWindow(app::VKEY_DOWN, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_DOWN, 0); } bool AutomatedUITest::PressEnterKey() { - return SimulateKeyPressInActiveWindow(app::VKEY_RETURN, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_RETURN, 0); } bool AutomatedUITest::PressEscapeKey() { - return SimulateKeyPressInActiveWindow(app::VKEY_ESCAPE, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_ESCAPE, 0); } bool AutomatedUITest::PressPageDown() { - return SimulateKeyPressInActiveWindow(app::VKEY_PRIOR, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_PRIOR, 0); } bool AutomatedUITest::PressPageUp() { - return SimulateKeyPressInActiveWindow(app::VKEY_NEXT, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_NEXT, 0); } bool AutomatedUITest::PressSpaceBar() { - return SimulateKeyPressInActiveWindow(app::VKEY_SPACE, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_SPACE, 0); } bool AutomatedUITest::PressTabKey() { - return SimulateKeyPressInActiveWindow(app::VKEY_TAB, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_TAB, 0); } bool AutomatedUITest::PressUpArrow() { - return SimulateKeyPressInActiveWindow(app::VKEY_UP, 0); + return SimulateKeyPressInActiveWindow(ui::VKEY_UP, 0); } bool AutomatedUITest::StarPage() { @@ -605,7 +605,7 @@ bool AutomatedUITest::ForceCrash() { return true; } -bool AutomatedUITest::SimulateKeyPressInActiveWindow(app::KeyboardCode key, +bool AutomatedUITest::SimulateKeyPressInActiveWindow(ui::KeyboardCode key, int flags) { scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); if (window.get() == NULL) { diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.h b/chrome/test/automated_ui_tests/automated_ui_tests.h index ef7b1f3..e6345e9 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.h +++ b/chrome/test/automated_ui_tests/automated_ui_tests.h @@ -103,9 +103,9 @@ #include <string> -#include "app/keyboard_codes.h" #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" #include "chrome/test/ui/ui_test.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace base { class Time; @@ -295,7 +295,7 @@ class AutomatedUITest : public AutomatedUITestBase { // Calls SimulateOSKeyPress on the active window. Simulates a key press at // the OS level. |key| is the key pressed and |flags| specifies which // modifiers keys are also pressed (as defined in chrome/views/event.h). - bool SimulateKeyPressInActiveWindow(app::KeyboardCode key, int flags); + bool SimulateKeyPressInActiveWindow(ui::KeyboardCode key, int flags); // Opens init file, reads it into the reader, and closes the file. // Returns false if there are any errors. diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc index 3230c08..775c27c 100644 --- a/chrome/test/automation/window_proxy.cc +++ b/chrome/test/automation/window_proxy.cc @@ -40,7 +40,7 @@ bool WindowProxy::GetWindowTitle(string16* text) { return sender_->Send(new AutomationMsg_WindowTitle(handle_, text)); } -bool WindowProxy::SimulateOSKeyPress(app::KeyboardCode key, int flags) { +bool WindowProxy::SimulateOSKeyPress(ui::KeyboardCode key, int flags) { if (!is_valid()) return false; return sender_->Send( diff --git a/chrome/test/automation/window_proxy.h b/chrome/test/automation/window_proxy.h index 27b87d4..dab17f6 100644 --- a/chrome/test/automation/window_proxy.h +++ b/chrome/test/automation/window_proxy.h @@ -12,10 +12,10 @@ #include <windows.h> #endif -#include "app/keyboard_codes.h" #include "base/string16.h" #include "base/threading/thread.h" #include "chrome/test/automation/automation_handle_tracker.h" +#include "ui/base/keycodes/keyboard_codes.h" class BrowserProxy; class WindowProxy; @@ -54,7 +54,7 @@ class WindowProxy : public AutomationResourceProxy { // key pressed and |flags| specifies which modifiers keys are also pressed (as // defined in chrome/views/event.h). Note that this actually sends the event // to the window that has focus. - bool SimulateOSKeyPress(app::KeyboardCode key, int flags); + bool SimulateOSKeyPress(ui::KeyboardCode key, int flags); // Shows/hides the window and as a result makes it active/inactive. // Returns true if the call was successful. diff --git a/chrome/test/interactive_ui/keyboard_access_uitest.cc b/chrome/test/interactive_ui/keyboard_access_uitest.cc index 4bb92a8..fe80efc 100644 --- a/chrome/test/interactive_ui/keyboard_access_uitest.cc +++ b/chrome/test/interactive_ui/keyboard_access_uitest.cc @@ -2,12 +2,12 @@ // 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 "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" #include "googleurl/src/gurl.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "views/event.h" // This functionality currently works on Windows and on Linux when @@ -60,12 +60,12 @@ void KeyboardAccessTest::TestMenuKeyboardAccess(bool alternate_key_sequence, int original_view_id = -1; ASSERT_TRUE(window->GetFocusedViewID(&original_view_id)); - app::KeyboardCode menu_key = - alternate_key_sequence ? app::VKEY_MENU : app::VKEY_F10; + ui::KeyboardCode menu_key = + alternate_key_sequence ? ui::VKEY_MENU : ui::VKEY_F10; #if defined(OS_CHROMEOS) // Chrome OS has different function key accelerators, so we always use the // menu key there. - menu_key = app::VKEY_MENU; + menu_key = ui::VKEY_MENU; #endif ASSERT_TRUE(window->SimulateOSKeyPress(menu_key, modifiers)); @@ -86,16 +86,16 @@ void KeyboardAccessTest::TestMenuKeyboardAccess(bool alternate_key_sequence, ASSERT_TRUE(browser->StartTrackingPopupMenus()); if (alternate_key_sequence) - ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_DOWN, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_DOWN, 0)); else - ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_RETURN, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_RETURN, 0)); // Wait until the popup menu actually opens. ASSERT_TRUE(browser->WaitForPopupMenuToOpen()); // Press DOWN to select the first item, then RETURN to select it. - ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_DOWN, 0)); - ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_RETURN, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_DOWN, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_RETURN, 0)); // Wait for the new tab to appear. ASSERT_TRUE(browser->WaitForTabCountToBecome(2)); @@ -153,13 +153,13 @@ TEST_F(KeyboardAccessTest, MAYBE_ReserveKeyboardAccelerators) { scoped_refptr<WindowProxy> window(browser->GetWindow()); ASSERT_TRUE(window); ASSERT_TRUE(window->SimulateOSKeyPress( - app::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); + ui::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId ASSERT_TRUE(browser->ActivateTab(1)); ASSERT_TRUE(window->SimulateOSKeyPress( - app::VKEY_F4, views::Event::EF_CONTROL_DOWN)); + ui::VKEY_F4, views::Event::EF_CONTROL_DOWN)); ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); #endif } diff --git a/chrome/test/interactive_ui/npapi_interactive_test.cc b/chrome/test/interactive_ui/npapi_interactive_test.cc index c5a7884..725e3a1 100644 --- a/chrome/test/interactive_ui/npapi_interactive_test.cc +++ b/chrome/test/interactive_ui/npapi_interactive_test.cc @@ -1,42 +1,17 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. // // NPAPI interactive UI tests. // -#include "app/keyboard_codes.h" #include "base/file_path.h" #include "chrome/browser/net/url_request_mock_http_job.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/npapi_test_helper.h" #include "chrome/test/ui_test_utils.h" +#include "ui/base/keycodes/keyboard_codes.h" const char kTestCompleteCookie[] = "status"; const char kTestCompleteSuccess[] = "OK"; @@ -80,7 +55,7 @@ TEST_F(NPAPIVisiblePluginTester, FLAKY_GetURLRequest404Response) { automation()->WaitForAppModalDialog(); scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); ASSERT_TRUE(window.get()); - ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_ESCAPE, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0)); WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie, kTestCompleteSuccess, action_max_timeout_ms()); @@ -99,7 +74,7 @@ TEST_F(NPAPIVisiblePluginTester, DISABLED_SelfDeletePluginInvokeAlert) { ASSERT_TRUE(automation()->WaitForAppModalDialog()); scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); ASSERT_TRUE(window.get()); - ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_ESCAPE, 0)); + ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0)); WaitForFinish("self_delete_plugin_invoke_alert", "1", url, kTestCompleteCookie, kTestCompleteSuccess, diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index 19406fb..1d3777d 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -37,7 +37,6 @@ #include <fstream> #include <vector> -#include "app/keyboard_codes.h" #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" @@ -69,6 +68,7 @@ #include "chrome/test/reliability/page_load_test.h" #include "chrome/test/ui/ui_test.h" #include "net/base/net_util.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "v8/include/v8-testing.h" namespace { @@ -233,9 +233,9 @@ class PageLoadTest : public UITest { // Sleep for 2 seconds between commands. // This used to be settable but the flag went away. int sleep_time_ms = 2000; - window->SimulateOSKeyPress(app::VKEY_NEXT, 0); + window->SimulateOSKeyPress(ui::VKEY_NEXT, 0); base::PlatformThread::Sleep(sleep_time_ms); - window->SimulateOSKeyPress(app::VKEY_NEXT, 0); + window->SimulateOSKeyPress(ui::VKEY_NEXT, 0); base::PlatformThread::Sleep(sleep_time_ms); } } diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 123304d..47a7c53 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -206,7 +206,7 @@ int RenderViewTest::SendKeyEvent(MockKeyboard::Layout layout, // current locale. TODO(estade): fix this to respect |layout|. std::vector<GdkEvent*> events; app::SynthesizeKeyPressEvents( - NULL, static_cast<app::KeyboardCode>(key_code), + NULL, static_cast<ui::KeyboardCode>(key_code), modifiers & (MockKeyboard::LEFT_CONTROL | MockKeyboard::RIGHT_CONTROL), modifiers & (MockKeyboard::LEFT_SHIFT | MockKeyboard::RIGHT_SHIFT), modifiers & (MockKeyboard::LEFT_ALT | MockKeyboard::RIGHT_ALT), diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index 0618011..ad6d8c9 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -699,7 +699,7 @@ Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers) { } bool SendKeyPressSync(const Browser* browser, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, @@ -724,7 +724,7 @@ bool SendKeyPressSync(const Browser* browser, } bool SendKeyPressAndWait(const Browser* browser, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h index a0deb1c..ad661e9 100644 --- a/chrome/test/ui_test_utils.h +++ b/chrome/test/ui_test_utils.h @@ -11,7 +11,6 @@ #include <string> #include <set> -#include "app/keyboard_codes.h" #include "base/basictypes.h" #include "base/message_loop.h" #include "base/scoped_temp_dir.h" @@ -24,6 +23,7 @@ #include "chrome/test/automation/dom_element_proxy.h" #include "gfx/native_widget_types.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/window_open_disposition.h" class AppModalDialog; @@ -257,7 +257,7 @@ Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers); // out. This uses ui_controls::SendKeyPress, see it for details. Returns true // if the event was successfully sent and received. bool SendKeyPressSync(const Browser* browser, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, @@ -268,7 +268,7 @@ bool SendKeyPressSync(const Browser* browser, // ui_controls::SendKeyPress, see it for details. Returns true if the event was // successfully sent and both the event and notification were received. bool SendKeyPressAndWait(const Browser* browser, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, @@ -480,7 +480,7 @@ class WindowedNotificationObserverWithDetails template <class U> bool SendKeyPressAndWaitWithDetails( const Browser* browser, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, @@ -492,7 +492,7 @@ bool SendKeyPressAndWaitWithDetails( template <class U> bool SendKeyPressAndWaitWithDetails( const Browser* browser, - app::KeyboardCode key, + ui::KeyboardCode key, bool control, bool shift, bool alt, diff --git a/chrome/test/webdriver/keymap.cc b/chrome/test/webdriver/keymap.cc index 1ab0a31..bb08457 100644 --- a/chrome/test/webdriver/keymap.cc +++ b/chrome/test/webdriver/keymap.cc @@ -14,132 +14,132 @@ KeyMap::KeyMap() { // 0xE000-0xF8FF. // Special WebDriver NULL key; clears all modifiers. - keys_[L'\uE000'] = app::VKEY_UNKNOWN; - - keys_[L'\uE001'] = app::VKEY_UNKNOWN; // TODO(jmikhail): CANCEL - keys_[L'\uE002'] = app::VKEY_HELP; - keys_[L'\uE003'] = app::VKEY_BACK; // BACKSPACE - keys_[L'\uE004'] = app::VKEY_TAB; - keys_[L'\uE005'] = app::VKEY_CLEAR; - keys_[L'\uE006'] = app::VKEY_RETURN; - keys_[L'\uE007'] = app::VKEY_UNKNOWN; // TODO(jmikhail): ENTER - keys_[L'\uE008'] = app::VKEY_SHIFT; - keys_[L'\uE009'] = app::VKEY_CONTROL; - keys_[L'\uE00A'] = app::VKEY_MENU; // ALT - keys_[L'\uE00B'] = app::VKEY_PAUSE; - keys_[L'\uE00C'] = app::VKEY_ESCAPE; - keys_[L'\uE00D'] = app::VKEY_SPACE; - keys_[L'\uE00E'] = app::VKEY_PRIOR; // PAGEUP - keys_[L'\uE00F'] = app::VKEY_NEXT; // PAGEDOWN - keys_[L'\uE010'] = app::VKEY_END; - keys_[L'\uE011'] = app::VKEY_HOME; - keys_[L'\uE012'] = app::VKEY_LEFT; - keys_[L'\uE013'] = app::VKEY_UP; - keys_[L'\uE014'] = app::VKEY_RIGHT; - keys_[L'\uE015'] = app::VKEY_DOWN; - keys_[L'\uE016'] = app::VKEY_INSERT; - keys_[L'\uE017'] = app::VKEY_DELETE; - - keys_[L'\uE01A'] = app::VKEY_NUMPAD0; - keys_[L'\uE01B'] = app::VKEY_NUMPAD1; - keys_[L'\uE01C'] = app::VKEY_NUMPAD2; - keys_[L'\uE01D'] = app::VKEY_NUMPAD3; - keys_[L'\uE01E'] = app::VKEY_NUMPAD4; - keys_[L'\uE01F'] = app::VKEY_NUMPAD5; - keys_[L'\uE020'] = app::VKEY_NUMPAD6; - keys_[L'\uE021'] = app::VKEY_NUMPAD7; - keys_[L'\uE022'] = app::VKEY_NUMPAD8; - keys_[L'\uE023'] = app::VKEY_NUMPAD9; - keys_[L'\uE024'] = app::VKEY_MULTIPLY; - keys_[L'\uE025'] = app::VKEY_ADD; - keys_[L'\uE026'] = app::VKEY_SEPARATOR; - keys_[L'\uE027'] = app::VKEY_SUBTRACT; - keys_[L'\uE028'] = app::VKEY_DECIMAL; - keys_[L'\uE029'] = app::VKEY_DIVIDE; - - keys_[L'\uE031'] = app::VKEY_F1; - keys_[L'\uE032'] = app::VKEY_F2; - keys_[L'\uE033'] = app::VKEY_F3; - keys_[L'\uE034'] = app::VKEY_F4; - keys_[L'\uE035'] = app::VKEY_F5; - keys_[L'\uE036'] = app::VKEY_F6; - keys_[L'\uE037'] = app::VKEY_F7; - keys_[L'\uE038'] = app::VKEY_F8; - keys_[L'\uE039'] = app::VKEY_F9; - keys_[L'\uE03A'] = app::VKEY_F10; - keys_[L'\uE03B'] = app::VKEY_F11; - keys_[L'\uE03C'] = app::VKEY_F12; + keys_[L'\uE000'] = ui::VKEY_UNKNOWN; + + keys_[L'\uE001'] = ui::VKEY_UNKNOWN; // TODO(jmikhail): CANCEL + keys_[L'\uE002'] = ui::VKEY_HELP; + keys_[L'\uE003'] = ui::VKEY_BACK; // BACKSPACE + keys_[L'\uE004'] = ui::VKEY_TAB; + keys_[L'\uE005'] = ui::VKEY_CLEAR; + keys_[L'\uE006'] = ui::VKEY_RETURN; + keys_[L'\uE007'] = ui::VKEY_UNKNOWN; // TODO(jmikhail): ENTER + keys_[L'\uE008'] = ui::VKEY_SHIFT; + keys_[L'\uE009'] = ui::VKEY_CONTROL; + keys_[L'\uE00A'] = ui::VKEY_MENU; // ALT + keys_[L'\uE00B'] = ui::VKEY_PAUSE; + keys_[L'\uE00C'] = ui::VKEY_ESCAPE; + keys_[L'\uE00D'] = ui::VKEY_SPACE; + keys_[L'\uE00E'] = ui::VKEY_PRIOR; // PAGEUP + keys_[L'\uE00F'] = ui::VKEY_NEXT; // PAGEDOWN + keys_[L'\uE010'] = ui::VKEY_END; + keys_[L'\uE011'] = ui::VKEY_HOME; + keys_[L'\uE012'] = ui::VKEY_LEFT; + keys_[L'\uE013'] = ui::VKEY_UP; + keys_[L'\uE014'] = ui::VKEY_RIGHT; + keys_[L'\uE015'] = ui::VKEY_DOWN; + keys_[L'\uE016'] = ui::VKEY_INSERT; + keys_[L'\uE017'] = ui::VKEY_DELETE; + + keys_[L'\uE01A'] = ui::VKEY_NUMPAD0; + keys_[L'\uE01B'] = ui::VKEY_NUMPAD1; + keys_[L'\uE01C'] = ui::VKEY_NUMPAD2; + keys_[L'\uE01D'] = ui::VKEY_NUMPAD3; + keys_[L'\uE01E'] = ui::VKEY_NUMPAD4; + keys_[L'\uE01F'] = ui::VKEY_NUMPAD5; + keys_[L'\uE020'] = ui::VKEY_NUMPAD6; + keys_[L'\uE021'] = ui::VKEY_NUMPAD7; + keys_[L'\uE022'] = ui::VKEY_NUMPAD8; + keys_[L'\uE023'] = ui::VKEY_NUMPAD9; + keys_[L'\uE024'] = ui::VKEY_MULTIPLY; + keys_[L'\uE025'] = ui::VKEY_ADD; + keys_[L'\uE026'] = ui::VKEY_SEPARATOR; + keys_[L'\uE027'] = ui::VKEY_SUBTRACT; + keys_[L'\uE028'] = ui::VKEY_DECIMAL; + keys_[L'\uE029'] = ui::VKEY_DIVIDE; + + keys_[L'\uE031'] = ui::VKEY_F1; + keys_[L'\uE032'] = ui::VKEY_F2; + keys_[L'\uE033'] = ui::VKEY_F3; + keys_[L'\uE034'] = ui::VKEY_F4; + keys_[L'\uE035'] = ui::VKEY_F5; + keys_[L'\uE036'] = ui::VKEY_F6; + keys_[L'\uE037'] = ui::VKEY_F7; + keys_[L'\uE038'] = ui::VKEY_F8; + keys_[L'\uE039'] = ui::VKEY_F9; + keys_[L'\uE03A'] = ui::VKEY_F10; + keys_[L'\uE03B'] = ui::VKEY_F11; + keys_[L'\uE03C'] = ui::VKEY_F12; // Common aliases. - keys_[L'\t'] = app::VKEY_TAB; - keys_[L'\n'] = app::VKEY_RETURN; - keys_[L'\r'] = app::VKEY_RETURN; - keys_[L'\b'] = app::VKEY_BACK; + keys_[L'\t'] = ui::VKEY_TAB; + keys_[L'\n'] = ui::VKEY_RETURN; + keys_[L'\r'] = ui::VKEY_RETURN; + keys_[L'\b'] = ui::VKEY_BACK; - keys_[L' '] = app::VKEY_SPACE; + keys_[L' '] = ui::VKEY_SPACE; // Alpha keys match their ASCII values. for (int i = 0; i < 26; ++i) { keys_[static_cast<wchar_t>(L'a' + i)] = \ - static_cast<app::KeyboardCode>(app::VKEY_A + i); + static_cast<ui::KeyboardCode>(ui::VKEY_A + i); shifted_keys_[static_cast<wchar_t>(L'A' + i)] = \ - static_cast<app::KeyboardCode>(app::VKEY_A + i); + static_cast<ui::KeyboardCode>(ui::VKEY_A + i); } // Numeric keys match their ASCII values. for (int i = 0; i < 10; ++i) { keys_[static_cast<wchar_t>(L'0' + i)] = \ - static_cast<app::KeyboardCode>(app::VKEY_0 + i); + static_cast<ui::KeyboardCode>(ui::VKEY_0 + i); } // The following all assumes the standard US keyboard. // TODO(jmikhail): Lookup correct keycode based on the current system keyboard // layout. Right now it's fixed assuming standard ANSI. - keys_[L'='] = shifted_keys_[L'+'] = app::VKEY_OEM_PLUS; - keys_[L'-'] = shifted_keys_[L'_'] = app::VKEY_OEM_MINUS; - keys_[L';'] = shifted_keys_[L':'] = app::VKEY_OEM_1; - keys_[L'/'] = shifted_keys_[L'?'] = app::VKEY_OEM_2; - keys_[L'`'] = shifted_keys_[L'~'] = app::VKEY_OEM_3; - keys_[L'['] = shifted_keys_[L'{'] = app::VKEY_OEM_4; - keys_[L'\\'] = shifted_keys_[L'|'] = app::VKEY_OEM_5; - keys_[L']'] = shifted_keys_[L'}'] = app::VKEY_OEM_6; - keys_[L'\''] = shifted_keys_[L'"'] = app::VKEY_OEM_7; - keys_[L','] = shifted_keys_[L'<'] = app::VKEY_OEM_COMMA; - keys_[L'.'] = shifted_keys_[L'>'] = app::VKEY_OEM_PERIOD; - shifted_keys_[L'!'] = app::VKEY_1; - shifted_keys_[L'@'] = app::VKEY_2; - shifted_keys_[L'#'] = app::VKEY_3; - shifted_keys_[L'$'] = app::VKEY_4; - shifted_keys_[L'%'] = app::VKEY_5; - shifted_keys_[L'^'] = app::VKEY_6; - shifted_keys_[L'&'] = app::VKEY_7; - shifted_keys_[L'*'] = app::VKEY_8; - shifted_keys_[L'('] = app::VKEY_9; - shifted_keys_[L')'] = app::VKEY_0; + keys_[L'='] = shifted_keys_[L'+'] = ui::VKEY_OEM_PLUS; + keys_[L'-'] = shifted_keys_[L'_'] = ui::VKEY_OEM_MINUS; + keys_[L';'] = shifted_keys_[L':'] = ui::VKEY_OEM_1; + keys_[L'/'] = shifted_keys_[L'?'] = ui::VKEY_OEM_2; + keys_[L'`'] = shifted_keys_[L'~'] = ui::VKEY_OEM_3; + keys_[L'['] = shifted_keys_[L'{'] = ui::VKEY_OEM_4; + keys_[L'\\'] = shifted_keys_[L'|'] = ui::VKEY_OEM_5; + keys_[L']'] = shifted_keys_[L'}'] = ui::VKEY_OEM_6; + keys_[L'\''] = shifted_keys_[L'"'] = ui::VKEY_OEM_7; + keys_[L','] = shifted_keys_[L'<'] = ui::VKEY_OEM_COMMA; + keys_[L'.'] = shifted_keys_[L'>'] = ui::VKEY_OEM_PERIOD; + shifted_keys_[L'!'] = ui::VKEY_1; + shifted_keys_[L'@'] = ui::VKEY_2; + shifted_keys_[L'#'] = ui::VKEY_3; + shifted_keys_[L'$'] = ui::VKEY_4; + shifted_keys_[L'%'] = ui::VKEY_5; + shifted_keys_[L'^'] = ui::VKEY_6; + shifted_keys_[L'&'] = ui::VKEY_7; + shifted_keys_[L'*'] = ui::VKEY_8; + shifted_keys_[L'('] = ui::VKEY_9; + shifted_keys_[L')'] = ui::VKEY_0; } -app::KeyboardCode KeyMap::Get(const wchar_t& key) const { - std::map<wchar_t, app::KeyboardCode>::const_iterator it; +ui::KeyboardCode KeyMap::Get(const wchar_t& key) const { + std::map<wchar_t, ui::KeyboardCode>::const_iterator it; it = keys_.find(key); if (it == keys_.end()) { it = shifted_keys_.find(key); if (it == shifted_keys_.end()) { - return app::VKEY_UNKNOWN; + return ui::VKEY_UNKNOWN; } } return it->second; } bool KeyMap::Press(const scoped_refptr<WindowProxy>& window, - const app::KeyboardCode key_code, + const ui::KeyboardCode key_code, const wchar_t& key) { - if (key_code == app::VKEY_SHIFT) { + if (key_code == ui::VKEY_SHIFT) { shift_ = !shift_; - } else if (key_code == app::VKEY_CONTROL) { + } else if (key_code == ui::VKEY_CONTROL) { control_ = !control_; - } else if (key_code == app::VKEY_MENU) { // ALT + } else if (key_code == ui::VKEY_MENU) { // ALT alt_ = !alt_; - } else if (key_code == app::VKEY_COMMAND) { + } else if (key_code == ui::VKEY_COMMAND) { command_ = !command_; } diff --git a/chrome/test/webdriver/keymap.h b/chrome/test/webdriver/keymap.h index b0abf46..fab2bcc 100644 --- a/chrome/test/webdriver/keymap.h +++ b/chrome/test/webdriver/keymap.h @@ -7,8 +7,8 @@ #include <map> -#include "app/keyboard_codes.h" #include "chrome/test/automation/window_proxy.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace webdriver { @@ -16,10 +16,10 @@ namespace webdriver { class KeyMap { public: KeyMap(); - app::KeyboardCode Get(const wchar_t& key) const; + ui::KeyboardCode Get(const wchar_t& key) const; bool Press(const scoped_refptr<WindowProxy>& window, - const app::KeyboardCode key_code, + const ui::KeyboardCode key_code, const wchar_t& key); // Sets the Shift, Alt, Cntl, and Cmd keys to not pressed. @@ -30,8 +30,8 @@ class KeyMap { bool alt_; bool control_; bool command_; - std::map<wchar_t, app::KeyboardCode> keys_; - std::map<wchar_t, app::KeyboardCode> shifted_keys_; + std::map<wchar_t, ui::KeyboardCode> keys_; + std::map<wchar_t, ui::KeyboardCode> shifted_keys_; DISALLOW_COPY_AND_ASSIGN(KeyMap); }; diff --git a/remoting/host/DEPS b/remoting/host/DEPS index 8d94267..c94d231 100644 --- a/remoting/host/DEPS +++ b/remoting/host/DEPS @@ -1,6 +1,6 @@ include_rules = [ - "+app", "+gfx", + "+ui", "+remoting/protocol", "+remoting/jingle_glue", diff --git a/remoting/host/event_executor_win.cc b/remoting/host/event_executor_win.cc index 4c92816..b1fe052 100644 --- a/remoting/host/event_executor_win.cc +++ b/remoting/host/event_executor_win.cc @@ -6,11 +6,11 @@ #include <windows.h> -#include "app/keyboard_codes.h" #include "base/message_loop.h" #include "base/stl_util-inl.h" #include "remoting/host/capturer.h" #include "remoting/proto/event.pb.h" +#include "ui/base/keycodes/keyboard_codes.h" namespace remoting { diff --git a/app/keyboard_code_conversion.cc b/ui/base/keycodes/keyboard_code_conversion.cc index 00f3c83..fe4db85 100644 --- a/app/keyboard_code_conversion.cc +++ b/ui/base/keycodes/keyboard_code_conversion.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/keyboard_code_conversion.h" +#include "ui/base/keycodes/keyboard_code_conversion.h" #include <string.h> -#include "app/keyboard_codes.h" +#include "ui/base/keycodes/keyboard_codes.h" -namespace app { +namespace ui { namespace { @@ -293,4 +293,4 @@ KeyboardCode KeyCodeFromKeyIdentifier(const std::string& key_identifier) { return id->key_code; } -} // namespace app +} // namespace ui diff --git a/app/keyboard_code_conversion.h b/ui/base/keycodes/keyboard_code_conversion.h index 4867c1b..a7a8331 100644 --- a/app/keyboard_code_conversion.h +++ b/ui/base/keycodes/keyboard_code_conversion.h @@ -1,22 +1,22 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef APP_KEYBOARD_CODE_CONVERSION_H_ -#define APP_KEYBOARD_CODE_CONVERSION_H_ +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ #pragma once -#include "app/keyboard_codes.h" +#include "ui/base/keycodes/keyboard_codes.h" #include <string> -namespace app { +namespace ui { // Convert a KeyIdentifer (see Section 6.3.3 here: // http://www.w3.org/TR/DOM-Level-3-Events/#keyset-keyidentifiers) -// to a app::KeyboardCode. +// to a ui::KeyboardCode. KeyboardCode KeyCodeFromKeyIdentifier(const std::string& key_identifier); -} // namespace +} // namespace ui -#endif // APP_KEYBOARD_CODE_CONVERSION_H_ +#endif // UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_H_ diff --git a/app/keyboard_code_conversion_gtk.cc b/ui/base/keycodes/keyboard_code_conversion_gtk.cc index 5a4b9d7..f2e65a5 100644 --- a/app/keyboard_code_conversion_gtk.cc +++ b/ui/base/keycodes/keyboard_code_conversion_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,15 +33,15 @@ // WindowsKeyCodeForGdkKeyCode is copied from platform/gtk/KeyEventGtk.cpp -#include "app/keyboard_code_conversion_gtk.h" +#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" #include <gdk/gdkkeysyms.h> -#include "app/keyboard_codes_posix.h" +#include "ui/base/keycodes/keyboard_codes_posix.h" -namespace app { +namespace ui { -app::KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode) { +KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode) { switch (keycode) { case GDK_KP_0: return VKEY_NUMPAD0; // (60) Numeric keypad 0 key @@ -403,14 +403,14 @@ app::KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode) { case GDK_F22: case GDK_F23: case GDK_F24: - return static_cast<app::KeyboardCode>(VKEY_F1 + (keycode - GDK_F1)); + return static_cast<KeyboardCode>(VKEY_F1 + (keycode - GDK_F1)); default: return VKEY_UNKNOWN; } } // TODO(jcampan): this method might be incomplete. -int GdkKeyCodeForWindowsKeyCode(app::KeyboardCode keycode, bool shift) { +int GdkKeyCodeForWindowsKeyCode(KeyboardCode keycode, bool shift) { switch (keycode) { case VKEY_NUMPAD0: return GDK_KP_0; @@ -614,4 +614,4 @@ int GdkKeyCodeForWindowsKeyCode(app::KeyboardCode keycode, bool shift) { } } -} // namespace app +} // namespace ui diff --git a/app/keyboard_code_conversion_gtk.h b/ui/base/keycodes/keyboard_code_conversion_gtk.h index 4530562..e30d8d9 100644 --- a/app/keyboard_code_conversion_gtk.h +++ b/ui/base/keycodes/keyboard_code_conversion_gtk.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,18 +33,18 @@ // WindowsKeyCodeForGdkKeyCode is copied from platform/gtk/KeyEventGtk.cpp -#ifndef APP_KEYBOARD_CODE_CONVERSION_GTK_H_ -#define APP_KEYBOARD_CODE_CONVERSION_GTK_H_ +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_GTK_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_GTK_H_ #pragma once -#include "app/keyboard_codes_posix.h" +#include "ui/base/keycodes/keyboard_codes_posix.h" -namespace app { +namespace ui { -app::KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode); +KeyboardCode WindowsKeyCodeForGdkKeyCode(int keycode); -int GdkKeyCodeForWindowsKeyCode(app::KeyboardCode keycode, bool shift); +int GdkKeyCodeForWindowsKeyCode(KeyboardCode keycode, bool shift); -} // namespace +} // namespace ui -#endif // APP_KEYBOARD_CODE_CONVERSION_GTK_H_ +#endif // UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_GTK_H_ diff --git a/app/keyboard_code_conversion_mac.h b/ui/base/keycodes/keyboard_code_conversion_mac.h index 2082c83..f277718 100644 --- a/app/keyboard_code_conversion_mac.h +++ b/ui/base/keycodes/keyboard_code_conversion_mac.h @@ -1,15 +1,16 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef APP_KEYBOARD_CODE_CONVERSION_MAC_H_ -#define APP_KEYBOARD_CODE_CONVERSION_MAC_H_ +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_MAC_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_MAC_H_ #import <Cocoa/Cocoa.h> -#include "app/keyboard_codes_posix.h" + #include "base/basictypes.h" +#include "ui/base/keycodes/keyboard_codes_posix.h" -namespace app { +namespace ui { // We use windows virtual keycodes throughout our keyboard event related code, // including unit tests. But Mac uses a different set of virtual keycodes. @@ -29,6 +30,6 @@ int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode, unichar* character, unichar* characterIgnoringModifiers); -} // namespace app +} // namespace ui -#endif // APP_KEYBOARD_CODE_CONVERSION_MAC_H_ +#endif // UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_MAC_H_ diff --git a/app/keyboard_code_conversion_mac.mm b/ui/base/keycodes/keyboard_code_conversion_mac.mm index 63d4553..e3c3665 100644 --- a/app/keyboard_code_conversion_mac.mm +++ b/ui/base/keycodes/keyboard_code_conversion_mac.mm @@ -1,15 +1,15 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "app/keyboard_code_conversion_mac.h" +#import "ui/base/keycodes/keyboard_code_conversion_mac.h" #include <algorithm> #import <Carbon/Carbon.h> #include "base/logging.h" -namespace app { +namespace ui { namespace { @@ -290,4 +290,4 @@ int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode, return macKeycode; } -} // namespace app +} // namespace ui diff --git a/ui/base/keycodes/keyboard_code_conversion_unittest.cc b/ui/base/keycodes/keyboard_code_conversion_unittest.cc new file mode 100644 index 0000000..689145a --- /dev/null +++ b/ui/base/keycodes/keyboard_code_conversion_unittest.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/keycodes/keyboard_code_conversion.h" +#include "ui/base/keycodes/keyboard_codes.h" +#include "base/logging.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace ui { + +TEST(KeyCodeFromKeyIdentifierTest, MatchOnIdentifier) { + EXPECT_EQ(VKEY_APPS, KeyCodeFromKeyIdentifier("Apps")); + EXPECT_EQ(VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("Nonsense")); +} + +TEST(KeyCodeFromKeyIdentifierTest, MatchOnCharacter) { + EXPECT_EQ(VKEY_A, KeyCodeFromKeyIdentifier("a")); + EXPECT_EQ(VKEY_A, KeyCodeFromKeyIdentifier("A")); + EXPECT_EQ(VKEY_OEM_PERIOD, KeyCodeFromKeyIdentifier(">")); + + std::string non_printing_char(" "); + non_printing_char[0] = static_cast<char>(1); + EXPECT_EQ(VKEY_UNKNOWN, KeyCodeFromKeyIdentifier(non_printing_char)); +} + +TEST(KeyCodeFromKeyIdentifierTest, MatchOnUnicodeCodepoint) { + EXPECT_EQ(VKEY_A, KeyCodeFromKeyIdentifier("U+0041")); + EXPECT_EQ(VKEY_A, KeyCodeFromKeyIdentifier("U+0061")); + EXPECT_EQ(VKEY_DELETE, KeyCodeFromKeyIdentifier("U+007F")); + + // this one exists in the map, but has no valid VKEY + EXPECT_EQ(VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+030A")); + + // this one is not in the map + EXPECT_EQ(VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("U+0001")); +} + +TEST(KeyCodeFromKeyIdentifierTest, DoesNotMatchEmptyString) { + EXPECT_EQ(VKEY_UNKNOWN, KeyCodeFromKeyIdentifier("")); +} + +} // namespace ui diff --git a/ui/base/keycodes/keyboard_code_conversion_win.cc b/ui/base/keycodes/keyboard_code_conversion_win.cc new file mode 100644 index 0000000..f85cc50 --- /dev/null +++ b/ui/base/keycodes/keyboard_code_conversion_win.cc @@ -0,0 +1,17 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/keycodes/keyboard_code_conversion_win.h" + +namespace ui { + +WORD WindowsKeyCodeForKeyboardCode(KeyboardCode keycode) { + return static_cast<WORD>(keycode); +} + +KeyboardCode KeyboardCodeForWindowsKeyCode(WORD keycode) { + return static_cast<KeyboardCode>(keycode); +} + +} // namespace ui diff --git a/ui/base/keycodes/keyboard_code_conversion_win.h b/ui/base/keycodes/keyboard_code_conversion_win.h new file mode 100644 index 0000000..98310a1 --- /dev/null +++ b/ui/base/keycodes/keyboard_code_conversion_win.h @@ -0,0 +1,19 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_WIN_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_WIN_H_ +#pragma once + +#include "ui/base/keycodes/keyboard_codes.h" + +namespace ui { + +// Methods to convert ui::KeyboardCode/Windows virtual key type methods. +WORD WindowsKeyCodeForKeyboardCode(KeyboardCode keycode); +KeyboardCode KeyboardCodeForWindowsKeyCode(WORD keycode); + +} // namespace ui + +#endif // UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_WIN_H_ diff --git a/app/keyboard_code_conversion_x.cc b/ui/base/keycodes/keyboard_code_conversion_x.cc index d33cc19..47ce830 100644 --- a/app/keyboard_code_conversion_x.cc +++ b/ui/base/keycodes/keyboard_code_conversion_x.cc @@ -1,17 +1,17 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/keyboard_code_conversion_x.h" +#include "ui/base/keycodes/keyboard_code_conversion_x.h" #include <X11/keysym.h> #include <X11/Xlib.h> #include "base/logging.h" -namespace app { +namespace ui { -// Get an app::KeyboardCode from an X keyevent +// Get an ui::KeyboardCode from an X keyevent KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev) { KeySym keysym = XLookupKeysym(&xev->xkey, 0); @@ -269,7 +269,7 @@ KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev) { case XK_F22: case XK_F23: case XK_F24: - return static_cast<app::KeyboardCode>(VKEY_F1 + (keysym - XK_F1)); + return static_cast<KeyboardCode>(VKEY_F1 + (keysym - XK_F1)); // TODO(sad): some keycodes are still missing. } @@ -278,4 +278,4 @@ KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev) { return VKEY_UNKNOWN; } -} // namespace app +} // namespace ui diff --git a/ui/base/keycodes/keyboard_code_conversion_x.h b/ui/base/keycodes/keyboard_code_conversion_x.h new file mode 100644 index 0000000..3f780a2 --- /dev/null +++ b/ui/base/keycodes/keyboard_code_conversion_x.h @@ -0,0 +1,18 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ + +#include "ui/base/keycodes/keyboard_codes_posix.h" + +typedef union _XEvent XEvent; + +namespace ui { + +KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev); + +} // namespace ui + +#endif // UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ diff --git a/ui/base/keycodes/keyboard_codes.h b/ui/base/keycodes/keyboard_codes.h new file mode 100644 index 0000000..53cf8ff --- /dev/null +++ b/ui/base/keycodes/keyboard_codes.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODES_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODES_H_ +#pragma once + +#include "build/build_config.h" + +#if defined(OS_WIN) +#include "ui/base/keycodes/keyboard_codes_win.h" +#elif defined(OS_POSIX) +#include "ui/base/keycodes/keyboard_codes_posix.h" +#endif + +#endif // UI_BASE_KEYCODES_KEYBOARD_CODES_H_ diff --git a/app/keyboard_codes_posix.h b/ui/base/keycodes/keyboard_codes_posix.h index 666e68a..023701e 100644 --- a/app/keyboard_codes_posix.h +++ b/ui/base/keycodes/keyboard_codes_posix.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,11 +28,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef APP_KEYBOARD_CODES_POSIX_H_ -#define APP_KEYBOARD_CODES_POSIX_H_ +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODES_POSIX_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODES_POSIX_H_ #pragma once -namespace app { +namespace ui { typedef enum { VKEY_BACK = 0x08, @@ -205,6 +205,6 @@ typedef enum { VKEY_UNKNOWN = 0 } KeyboardCode; -} // namespace app +} // namespace ui -#endif // APP_KEYBOARD_CODES_POSIX_H_ +#endif // UI_BASE_KEYCODES_KEYBOARD_CODES_POSIX_H_ diff --git a/app/keyboard_codes_win.h b/ui/base/keycodes/keyboard_codes_win.h index 7c76dfd..362fc5f 100644 --- a/app/keyboard_codes_win.h +++ b/ui/base/keycodes/keyboard_codes_win.h @@ -1,14 +1,14 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef APP_KEYBOARD_CODES_WIN_H_ -#define APP_KEYBOARD_CODES_WIN_H_ +#ifndef UI_BASE_KEYCODES_KEYBOARD_CODES_WIN_H_ +#define UI_BASE_KEYCODES_KEYBOARD_CODES_WIN_H_ #pragma once #include <windows.h> -namespace app { +namespace ui { typedef enum { VKEY_BACK = VK_BACK, @@ -181,6 +181,6 @@ typedef enum { VKEY_UNKNOWN = 0 } KeyboardCode; -} // namespace app +} // namespace ui -#endif // APP_KEYBOARD_CODES_WIN_H_ +#endif // UI_BASE_KEYCODES_KEYBOARD_CODES_WIN_H_ 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); diff --git a/webkit/support/DEPS b/webkit/support/DEPS index b42ea7d..7cbc981 100644 --- a/webkit/support/DEPS +++ b/webkit/support/DEPS @@ -1,4 +1,5 @@ include_rules = [ "+app", - "+media" + "+media", + "+ui", ] diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h index 321a0bb..9150e0a 100644 --- a/webkit/support/webkit_support.h +++ b/webkit/support/webkit_support.h @@ -8,11 +8,11 @@ #include <string> #include <vector> -#include "app/keyboard_codes.h" #include "base/basictypes.h" #include "base/string16.h" #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgentClient.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" +#include "ui/base/keycodes/keyboard_codes.h" class WebURLLoaderMockFactory; namespace WebKit { @@ -161,19 +161,19 @@ void OpenFileSystem(WebKit::WebFrame* frame, WebKit::WebFileSystem::Type type, // -------- Keyboard code enum { - VKEY_LEFT = app::VKEY_LEFT, - VKEY_RIGHT = app::VKEY_RIGHT, - VKEY_UP = app::VKEY_UP, - VKEY_DOWN = app::VKEY_DOWN, - VKEY_RETURN = app::VKEY_RETURN, - VKEY_INSERT = app::VKEY_INSERT, - VKEY_DELETE = app::VKEY_DELETE, - VKEY_PRIOR = app::VKEY_PRIOR, - VKEY_NEXT = app::VKEY_NEXT, - VKEY_HOME = app::VKEY_HOME, - VKEY_END = app::VKEY_END, - VKEY_SNAPSHOT = app::VKEY_SNAPSHOT, - VKEY_F1 = app::VKEY_F1, + VKEY_LEFT = ui::VKEY_LEFT, + VKEY_RIGHT = ui::VKEY_RIGHT, + VKEY_UP = ui::VKEY_UP, + VKEY_DOWN = ui::VKEY_DOWN, + VKEY_RETURN = ui::VKEY_RETURN, + VKEY_INSERT = ui::VKEY_INSERT, + VKEY_DELETE = ui::VKEY_DELETE, + VKEY_PRIOR = ui::VKEY_PRIOR, + VKEY_NEXT = ui::VKEY_NEXT, + VKEY_HOME = ui::VKEY_HOME, + VKEY_END = ui::VKEY_END, + VKEY_SNAPSHOT = ui::VKEY_SNAPSHOT, + VKEY_F1 = ui::VKEY_F1, }; } // namespace webkit_support diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc index d86d374..ba7c484 100644 --- a/webkit/tools/test_shell/event_sending_controller.cc +++ b/webkit/tools/test_shell/event_sending_controller.cc @@ -19,7 +19,6 @@ #include <queue> #include <vector> -#include "app/keyboard_codes.h" #include "base/compiler_specific.h" #include "base/file_path.h" #include "base/file_util.h" @@ -36,6 +35,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebTouchPoint.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/test_shell.h" #include "webkit/tools/test_shell/test_webview_delegate.h" @@ -215,16 +215,16 @@ bool GetEditCommand(const WebKeyboardEvent& event, std::string* name) { return false; switch (event.windowsKeyCode) { - case app::VKEY_LEFT: + case ui::VKEY_LEFT: *name = "MoveToBeginningOfLine"; break; - case app::VKEY_RIGHT: + case ui::VKEY_RIGHT: *name = "MoveToEndOfLine"; break; - case app::VKEY_UP: + case ui::VKEY_UP: *name = "MoveToBeginningOfDocument"; break; - case app::VKEY_DOWN: + case ui::VKEY_DOWN: *name = "MoveToEndOfDocument"; break; default: @@ -535,29 +535,29 @@ void EventSendingController::keyDown( bool needs_shift_key_modifier = false; if (L"\n" == code_str) { generate_char = true; - text = code = app::VKEY_RETURN; + text = code = ui::VKEY_RETURN; } else if (L"rightArrow" == code_str) { - code = app::VKEY_RIGHT; + code = ui::VKEY_RIGHT; } else if (L"downArrow" == code_str) { - code = app::VKEY_DOWN; + code = ui::VKEY_DOWN; } else if (L"leftArrow" == code_str) { - code = app::VKEY_LEFT; + code = ui::VKEY_LEFT; } else if (L"upArrow" == code_str) { - code = app::VKEY_UP; + code = ui::VKEY_UP; } else if (L"insert" == code_str) { - code = app::VKEY_INSERT; + code = ui::VKEY_INSERT; } else if (L"delete" == code_str) { - code = app::VKEY_DELETE; + code = ui::VKEY_DELETE; } else if (L"pageUp" == code_str) { - code = app::VKEY_PRIOR; + code = ui::VKEY_PRIOR; } else if (L"pageDown" == code_str) { - code = app::VKEY_NEXT; + code = ui::VKEY_NEXT; } else if (L"home" == code_str) { - code = app::VKEY_HOME; + code = ui::VKEY_HOME; } else if (L"end" == code_str) { - code = app::VKEY_END; + code = ui::VKEY_END; } else if (L"printScreen" == code_str) { - code = app::VKEY_SNAPSHOT; + code = ui::VKEY_SNAPSHOT; } else { // Compare the input string with the function-key names defined by the // DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key @@ -567,7 +567,7 @@ void EventSendingController::keyDown( function_key_name += L"F"; function_key_name += UTF8ToWide(base::IntToString(i)); if (function_key_name == code_str) { - code = app::VKEY_F1 + (i - 1); + code = ui::VKEY_F1 + (i - 1); break; } } @@ -783,12 +783,12 @@ MakeMenuItemStringsFor(const WebKit::WebContextMenuData* context_menu, // These constants are based on Safari's context menu because tests // are made for it. static const char* kNonEditableMenuStrings[] = { - "Back", "Reload Page", "Open in Dashbaord", "<separator>", - "View Source", "Save Page As", "Print Page", "Inspect Element", + "Back", "Reload Page", "Open in Dashbaord", "<separator>", + "View Source", "Save Page As", "Print Page", "Inspect Element", 0 }; static const char* kEditableMenuStrings[] = { "Cut", "Copy", "<separator>", "Paste", "Spelling and Grammar", - "Substitutions, Transformations", "Font", "Speech", + "Substitutions, Transformations", "Font", "Speech", "Paragraph Direction", "<separator>", 0 }; // This is possible because mouse events are cancelleable. |