OLD | NEW |
1 // Copyright (c) 2012 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/ui/views/aura/caps_lock_handler.h" |
11 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" | 12 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
12 #include "chrome/browser/ui/views/aura/screen_orientation_listener.h" | 13 #include "chrome/browser/ui/views/aura/screen_orientation_listener.h" |
13 #include "chrome/browser/ui/views/aura/screenshot_taker.h" | 14 #include "chrome/browser/ui/views/aura/screenshot_taker.h" |
14 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
15 #include "ui/gfx/compositor/compositor_setup.h" | 16 #include "ui/gfx/compositor/compositor_setup.h" |
16 | 17 |
17 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
| 19 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
18 #include "chrome/browser/chromeos/system/runtime_environment.h" | 20 #include "chrome/browser/chromeos/system/runtime_environment.h" |
19 #endif | 21 #endif |
20 | 22 |
21 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() | 23 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() |
22 : ChromeBrowserMainExtraParts() { | 24 : ChromeBrowserMainExtraParts() { |
23 } | 25 } |
24 | 26 |
25 void ChromeBrowserMainExtraPartsAura::PreProfileInit() { | 27 void ChromeBrowserMainExtraPartsAura::PreProfileInit() { |
26 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestCompositor)) { | 28 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestCompositor)) { |
27 ui::SetupTestCompositor(); | 29 ui::SetupTestCompositor(); |
28 } | 30 } |
29 | 31 |
30 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
31 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) | 33 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) |
32 aura::RootWindow::set_use_fullscreen_host_window(true); | 34 aura::RootWindow::set_use_fullscreen_host_window(true); |
33 #endif | 35 #endif |
34 | 36 |
35 // Shell takes ownership of ChromeShellDelegate. | 37 // Shell takes ownership of ChromeShellDelegate. |
36 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); | 38 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); |
37 shell->accelerator_controller()->SetScreenshotDelegate( | 39 shell->accelerator_controller()->SetScreenshotDelegate( |
38 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); | 40 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); |
| 41 #if defined(OS_CHROMEOS) |
| 42 chromeos::input_method::XKeyboard* xkeyboard = |
| 43 chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard(); |
| 44 shell->accelerator_controller()->SetCapsLockDelegate( |
| 45 scoped_ptr<ash::CapsLockDelegate>(new CapsLockHandler(xkeyboard)).Pass()); |
| 46 #endif |
39 | 47 |
40 // Make sure the singleton ScreenOrientationListener object is created. | 48 // Make sure the singleton ScreenOrientationListener object is created. |
41 ScreenOrientationListener::GetInstance(); | 49 ScreenOrientationListener::GetInstance(); |
42 } | 50 } |
43 | 51 |
44 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { | 52 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { |
45 ash::Shell::DeleteInstance(); | 53 ash::Shell::DeleteInstance(); |
46 aura::RootWindow::DeleteInstance(); | 54 aura::RootWindow::DeleteInstance(); |
47 } | 55 } |
OLD | NEW |