summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 23:08:47 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 23:08:47 +0000
commit218b229ae37b3ec8abcc6e13dd02d7d4b22c9f16 (patch)
tree12673fcf8a748d2281a9f963dd2a1bcb2a609cc2 /ash
parent412aa1764340f6c447f95b68c0e82477deaf039b (diff)
downloadchromium_src-218b229ae37b3ec8abcc6e13dd02d7d4b22c9f16.zip
chromium_src-218b229ae37b3ec8abcc6e13dd02d7d4b22c9f16.tar.gz
chromium_src-218b229ae37b3ec8abcc6e13dd02d7d4b22c9f16.tar.bz2
Bug=105964
Review URL: http://codereview.chromium.org/9124021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/accelerator_controller.cc13
-rw-r--r--ash/accelerators/accelerator_controller_unittest.cc4
-rw-r--r--ash/shell/shell_main.cc4
-rw-r--r--ash/shell_delegate.h3
-rw-r--r--ash/test/test_shell_delegate.cc3
-rw-r--r--ash/test/test_shell_delegate.h1
6 files changed, 28 insertions, 0 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 8a736d3..943d296 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -9,6 +9,7 @@
#include "ash/launcher/launcher_model.h"
#include "ash/screenshot_delegate.h"
#include "ash/shell.h"
+#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/window_cycle_controller.h"
#include "ui/aura/event.h"
@@ -25,6 +26,7 @@ namespace {
enum AcceleratorAction {
CYCLE_BACKWARD,
CYCLE_FORWARD,
+ EXIT,
TAKE_SCREENSHOT,
TOGGLE_CAPS_LOCK,
#if !defined(NDEBUG)
@@ -45,6 +47,7 @@ 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 },
+ { ui::VKEY_Q, true, true, false, EXIT },
{ ui::VKEY_F5, true, false, false, CYCLE_BACKWARD },
{ ui::VKEY_F5, false, true, false, TAKE_SCREENSHOT },
{ ui::VKEY_PRINT, false, false, false, TAKE_SCREENSHOT },
@@ -68,6 +71,14 @@ bool HandleCycleWindow(ash::WindowCycleController::Direction direction,
return true;
}
+bool HandleExit() {
+ ash::ShellDelegate* delegate = ash::Shell::GetInstance()->delegate();
+ if (!delegate)
+ return false;
+ delegate->Exit();
+ return true;
+}
+
#if !defined(NDEBUG)
// Rotates the screen.
bool HandleRotateScreen() {
@@ -186,6 +197,8 @@ bool AcceleratorController::AcceleratorPressed(
case CYCLE_FORWARD:
return HandleCycleWindow(WindowCycleController::FORWARD,
accelerator.IsAltDown());
+ case EXIT:
+ return HandleExit();
case TAKE_SCREENSHOT:
if (screenshot_delegate_.get())
screenshot_delegate_->HandleTakeScreenshot();
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index 1de432f..a9cce71 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -319,6 +319,10 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
EXPECT_TRUE(GetController()->Process(
ui::Accelerator(ui::VKEY_F11, false, true, false)));
#endif
+
+ // Exit
+ EXPECT_TRUE(GetController()->Process(
+ ui::Accelerator(ui::VKEY_Q, true, true ,false)));
#endif
}
diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc
index 4837071..e0521b3 100644
--- a/ash/shell/shell_main.cc
+++ b/ash/shell/shell_main.cc
@@ -58,6 +58,10 @@ class ShellDelegateImpl : public ash::ShellDelegate {
return ash::internal::CreateStatusArea();
}
+ virtual void Exit() OVERRIDE {
+ MessageLoopForUI::current()->Quit();
+ }
+
virtual void BuildAppListModel(ash::AppListModel* model) OVERRIDE {
ash::shell::BuildAppListModel(model);
}
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index ff60e8a..3be69cb 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -56,6 +56,9 @@ class ASH_EXPORT ShellDelegate {
// Invoked to create a new status area. Can return NULL.
virtual views::Widget* CreateStatusArea() = 0;
+ // Invoked when a user uses Ctrl-Shift-Q to close chrome.
+ virtual void Exit() = 0;
+
// Invoked to ask the delegate to populate the |model|.
virtual void BuildAppListModel(AppListModel* model) = 0;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index 67f1022..ef080e9 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -27,6 +27,9 @@ views::Widget* TestShellDelegate::CreateStatusArea() {
return NULL;
}
+void TestShellDelegate::Exit() {
+}
+
void TestShellDelegate::BuildAppListModel(AppListModel* model) {
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index c9e3ab3..9eedc96 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -20,6 +20,7 @@ class TestShellDelegate : public ShellDelegate {
// Overridden from ShellDelegate:
virtual void CreateNewWindow() OVERRIDE;
virtual views::Widget* CreateStatusArea() OVERRIDE;
+ virtual void Exit() OVERRIDE;
virtual void BuildAppListModel(AppListModel* model) OVERRIDE;
virtual AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
virtual std::vector<aura::Window*> GetCycleWindowList(