diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-23 21:53:54 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-23 21:53:54 +0000 |
commit | b752e7a73f1019fab2b3813981a72a75450e036f (patch) | |
tree | 3e9fbd28e98c95ff7f7d34d7dc1d352baea9b406 /ash | |
parent | 046c048dd4f59f43dc430ac60a3a0344d58a99fe (diff) | |
download | chromium_src-b752e7a73f1019fab2b3813981a72a75450e036f.zip chromium_src-b752e7a73f1019fab2b3813981a72a75450e036f.tar.gz chromium_src-b752e7a73f1019fab2b3813981a72a75450e036f.tar.bz2 |
Adds an accelerator to handle Ctrl-Shift-L during weird cases
BUG=106873
Review URL: https://chromiumcodereview.appspot.com/9132004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 20 | ||||
-rw-r--r-- | ash/accelerators/accelerator_controller_unittest.cc | 5 | ||||
-rw-r--r-- | ash/shell/shell_main.cc | 6 | ||||
-rw-r--r-- | ash/shell_delegate.h | 5 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 5 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.h | 3 |
6 files changed, 44 insertions, 0 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 943d296..d068eec 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -26,6 +26,9 @@ namespace { enum AcceleratorAction { CYCLE_BACKWARD, CYCLE_FORWARD, +#if defined(OS_CHROMEOS) + LOCK_SCREEN, +#endif EXIT, TAKE_SCREENSHOT, TOGGLE_CAPS_LOCK, @@ -47,6 +50,9 @@ struct AcceleratorData { { ui::VKEY_TAB, false, false, true, CYCLE_FORWARD }, { ui::VKEY_TAB, true, false, true, CYCLE_BACKWARD }, { ui::VKEY_F5, false, false, false, CYCLE_FORWARD }, +#if defined(OS_CHROMEOS) + { ui::VKEY_L, true, true, false, LOCK_SCREEN }, +#endif { ui::VKEY_Q, true, true, false, EXIT }, { ui::VKEY_F5, true, false, false, CYCLE_BACKWARD }, { ui::VKEY_F5, false, true, false, TAKE_SCREENSHOT }, @@ -71,6 +77,16 @@ bool HandleCycleWindow(ash::WindowCycleController::Direction direction, return true; } +#if defined(OS_CHROMEOS) +bool HandleLock() { + ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); + if (!delegate) + return false; + delegate->LockScreen(); + return true; +} +#endif + bool HandleExit() { ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); if (!delegate) @@ -197,6 +213,10 @@ bool AcceleratorController::AcceleratorPressed( case CYCLE_FORWARD: return HandleCycleWindow(WindowCycleController::FORWARD, accelerator.IsAltDown()); +#if defined(OS_CHROMEOS) + case LOCK_SCREEN: + return HandleLock(); +#endif case EXIT: return HandleExit(); case TAKE_SCREENSHOT: diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index a9cce71..91b3b9d 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -324,6 +324,11 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { EXPECT_TRUE(GetController()->Process( ui::Accelerator(ui::VKEY_Q, true, true ,false))); #endif + +#if defined(OS_CHROMEOS) + EXPECT_TRUE(GetController()->Process( + ui::Accelerator(ui::VKEY_L, true, true, false))); +#endif } } // namespace test diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc index e0521b3..7456af1 100644 --- a/ash/shell/shell_main.cc +++ b/ash/shell/shell_main.cc @@ -58,6 +58,12 @@ class ShellDelegateImpl : public ash::ShellDelegate { return ash::internal::CreateStatusArea(); } +#if defined(OS_CHROMEOS) + virtual void LockScreen() OVERRIDE { + ash::shell::CreateLockScreen(); + } +#endif + virtual void Exit() OVERRIDE { MessageLoopForUI::current()->Quit(); } diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 3be69cb..89acb92 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -56,6 +56,11 @@ class ASH_EXPORT ShellDelegate { // Invoked to create a new status area. Can return NULL. virtual views::Widget* CreateStatusArea() = 0; +#if defined(OS_CHROMEOS) + // Invoked when a user uses Ctrl-Shift-L to lock the screen. + virtual void LockScreen() = 0; +#endif + // Invoked when a user uses Ctrl-Shift-Q to close chrome. virtual void Exit() = 0; diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index ef080e9..198f925 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -27,6 +27,11 @@ views::Widget* TestShellDelegate::CreateStatusArea() { return NULL; } +#if defined(OS_CHROMEOS) +void TestShellDelegate::LockScreen() { +} +#endif + void TestShellDelegate::Exit() { } diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index 9eedc96..b8e443e 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -20,6 +20,9 @@ class TestShellDelegate : public ShellDelegate { // Overridden from ShellDelegate: virtual void CreateNewWindow() OVERRIDE; virtual views::Widget* CreateStatusArea() OVERRIDE; +#if defined(OS_CHROMEOS) + virtual void LockScreen() OVERRIDE; +#endif virtual void Exit() OVERRIDE; virtual void BuildAppListModel(AppListModel* model) OVERRIDE; virtual AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; |