diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/ui/browser_command_controller.cc | 13 | ||||
-rw-r--r-- | chrome/browser/ui/browser_command_controller_unittest.cc | 12 |
2 files changed, 13 insertions, 12 deletions
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index 4300e86..16d4f41 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -235,14 +235,15 @@ bool BrowserCommandController::IsReservedCommandOrKey( return false; #if defined(OS_CHROMEOS) - // On Chrome OS, the top row of keys are mapped to F1-F10. We don't want web - // pages to be able to change the behavior of these keys. Ash handles F4 and - // up; this leaves us needing to reserve F1-F3 here. + // On Chrome OS, the top row of keys are mapped to browser actions like + // back/forward or refresh. We don't want web pages to be able to change the + // behavior of these keys. Ash handles F4 and up; this leaves us needing to + // reserve browser back/forward and refresh here. ui::KeyboardCode key_code = static_cast<ui::KeyboardCode>(event.windowsKeyCode); - if ((key_code == ui::VKEY_F1 && command_id == IDC_BACK) || - (key_code == ui::VKEY_F2 && command_id == IDC_FORWARD) || - (key_code == ui::VKEY_F3 && command_id == IDC_RELOAD)) { + if ((key_code == ui::VKEY_BROWSER_BACK && command_id == IDC_BACK) || + (key_code == ui::VKEY_BROWSER_FORWARD && command_id == IDC_FORWARD) || + (key_code == ui::VKEY_BROWSER_REFRESH && command_id == IDC_RELOAD)) { return true; } #endif diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc index b9e5516..d37dade 100644 --- a/chrome/browser/ui/browser_command_controller_unittest.cc +++ b/chrome/browser/ui/browser_command_controller_unittest.cc @@ -27,14 +27,14 @@ TEST_F(BrowserCommandControllerTest, IsReservedCommandOrKey) { #if defined(OS_CHROMEOS) // F1-3 keys are reserved Chrome accelerators on Chrome OS. EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( - IDC_BACK, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED, false, - ui::VKEY_F1, 0, 0))); + IDC_BACK, content::NativeWebKeyboardEvent( + ui::ET_KEY_PRESSED, false, ui::VKEY_BROWSER_BACK, 0, 0))); EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( - IDC_FORWARD, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED, false, - ui::VKEY_F2, 0, 0))); + IDC_FORWARD, content::NativeWebKeyboardEvent( + ui::ET_KEY_PRESSED, false, ui::VKEY_BROWSER_FORWARD, 0, 0))); EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( - IDC_RELOAD, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED, false, - ui::VKEY_F3, 0, 0))); + IDC_RELOAD, content::NativeWebKeyboardEvent( + ui::ET_KEY_PRESSED, false, ui::VKEY_BROWSER_REFRESH, 0, 0))); // When there are modifier keys pressed, don't reserve. EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey( |