Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: chrome/browser/chrome_browser_main_extra_parts_aura.cc

Issue 9264002: aura: Add Ctrl-Shift-Q for quit and Ctrl-Shift-L for lock in chromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main_extra_parts_aura.cc
diff --git a/chrome/browser/chrome_browser_main_extra_parts_aura.cc b/chrome/browser/chrome_browser_main_extra_parts_aura.cc
index fca681202023a2618f3e10bc32196a27729cbae6..9fd360ed3c154b63ff61b6f2a75bc9de6faaa29f 100644
--- a/chrome/browser/chrome_browser_main_extra_parts_aura.cc
+++ b/chrome/browser/chrome_browser_main_extra_parts_aura.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -8,9 +8,13 @@
#include "ash/shell.h"
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
+#include "chrome/browser/chromeos/dbus/power_manager_client.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
#include "chrome/browser/ui/views/aura/screen_orientation_listener.h"
#include "chrome/browser/ui/views/aura/screenshot_taker.h"
+#include "content/public/browser/user_metrics.h"
#include "ui/aura/root_window.h"
#if defined(OS_CHROMEOS)
@@ -46,6 +50,11 @@ void ChromeBrowserMainExtraPartsAura::PreProfileInit() {
// AcceleratorController takes ownership of ScreenshotDelegate.
shell->accelerator_controller()->SetScreenshotDelegate(new ScreenshotTaker);
+ ui::Accelerator quit(ui::VKEY_Q, true, true, false);
sky 2012/01/19 05:02:12 Do we already have global accelerators defined som
+ ui::Accelerator lock(ui::VKEY_L, true, true, false);
+ shell->accelerator_controller()->Register(quit, this);
+ shell->accelerator_controller()->Register(lock, this);
+
// Make sure the singleton ScreenOrientationListener object is created.
ScreenOrientationListener::GetInstance();
}
@@ -54,3 +63,29 @@ void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() {
ash::Shell::DeleteInstance();
aura::RootWindow::DeleteInstance();
}
+
+bool ChromeBrowserMainExtraPartsAura::AcceleratorPressed(
+ const ui::Accelerator& accelerator) {
+ switch (accelerator.key_code()) {
+ case ui::VKEY_Q:
+ DCHECK_EQ(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
+ accelerator.modifiers());
+ content::RecordAction(content::UserMetricsAction("Exit"));
+ BrowserList::AttemptUserExit();
+ break;
+ case ui::VKEY_L:
+ DCHECK_EQ(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
+ accelerator.modifiers());
+ content::RecordAction(content::UserMetricsAction("LockScreen"));
+ chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
+ NotifyScreenLockRequested();
sky 2012/01/19 05:02:12 nit: spacing.
+ break;
+ default:
+ NOTREACHED();
+ }
+ return true;
+}
+
+bool ChromeBrowserMainExtraPartsAura::CanHandleAccelerators() const {
+ return true;
+}
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698