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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_aura.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main_extra_parts_aura.h" 5 #include "chrome/browser/chrome_browser_main_extra_parts_aura.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
12 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
13 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" 14 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
12 #include "chrome/browser/ui/views/aura/screen_orientation_listener.h" 15 #include "chrome/browser/ui/views/aura/screen_orientation_listener.h"
13 #include "chrome/browser/ui/views/aura/screenshot_taker.h" 16 #include "chrome/browser/ui/views/aura/screenshot_taker.h"
17 #include "content/public/browser/user_metrics.h"
14 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
15 19
16 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
17 #include "chrome/browser/chromeos/system/runtime_environment.h" 21 #include "chrome/browser/chromeos/system/runtime_environment.h"
18 #endif 22 #endif
19 23
20 #if defined(USE_WEBKIT_COMPOSITOR) 24 #if defined(USE_WEBKIT_COMPOSITOR)
21 #include "ui/gfx/compositor/compositor_setup.h" 25 #include "ui/gfx/compositor/compositor_setup.h"
22 #else 26 #else
23 #include "ui/gfx/test/gfx_test_utils.h" 27 #include "ui/gfx/test/gfx_test_utils.h"
(...skipping 15 matching lines...) Expand all
39 #if defined(OS_CHROMEOS) 43 #if defined(OS_CHROMEOS)
40 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) 44 if (chromeos::system::runtime_environment::IsRunningOnChromeOS())
41 aura::RootWindow::set_use_fullscreen_host_window(true); 45 aura::RootWindow::set_use_fullscreen_host_window(true);
42 #endif 46 #endif
43 47
44 // Shell takes ownership of ChromeShellDelegate. 48 // Shell takes ownership of ChromeShellDelegate.
45 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); 49 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate);
46 // AcceleratorController takes ownership of ScreenshotDelegate. 50 // AcceleratorController takes ownership of ScreenshotDelegate.
47 shell->accelerator_controller()->SetScreenshotDelegate(new ScreenshotTaker); 51 shell->accelerator_controller()->SetScreenshotDelegate(new ScreenshotTaker);
48 52
53 ui::Accelerator quit(ui::VKEY_Q, true, true, false);
sky 2012/01/19 05:02:12 Do we already have global accelerators defined som
54 ui::Accelerator lock(ui::VKEY_L, true, true, false);
55 shell->accelerator_controller()->Register(quit, this);
56 shell->accelerator_controller()->Register(lock, this);
57
49 // Make sure the singleton ScreenOrientationListener object is created. 58 // Make sure the singleton ScreenOrientationListener object is created.
50 ScreenOrientationListener::GetInstance(); 59 ScreenOrientationListener::GetInstance();
51 } 60 }
52 61
53 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { 62 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() {
54 ash::Shell::DeleteInstance(); 63 ash::Shell::DeleteInstance();
55 aura::RootWindow::DeleteInstance(); 64 aura::RootWindow::DeleteInstance();
56 } 65 }
66
67 bool ChromeBrowserMainExtraPartsAura::AcceleratorPressed(
68 const ui::Accelerator& accelerator) {
69 switch (accelerator.key_code()) {
70 case ui::VKEY_Q:
71 DCHECK_EQ(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
72 accelerator.modifiers());
73 content::RecordAction(content::UserMetricsAction("Exit"));
74 BrowserList::AttemptUserExit();
75 break;
76 case ui::VKEY_L:
77 DCHECK_EQ(ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN,
78 accelerator.modifiers());
79 content::RecordAction(content::UserMetricsAction("LockScreen"));
80 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
81 NotifyScreenLockRequested();
sky 2012/01/19 05:02:12 nit: spacing.
82 break;
83 default:
84 NOTREACHED();
85 }
86 return true;
87 }
88
89 bool ChromeBrowserMainExtraPartsAura::CanHandleAccelerators() const {
90 return true;
91 }
OLDNEW
« 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