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/ui/ash/ash_init.h" | 5 #include "chrome/browser/ui/ash/ash_init.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/high_contrast/high_contrast_controller.h" | 9 #include "ash/high_contrast/high_contrast_controller.h" |
10 #include "ash/magnifier/magnification_controller.h" | 10 #include "ash/magnifier/magnification_controller.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/wm/event_rewriter_event_filter.h" | 12 #include "ash/wm/event_rewriter_event_filter.h" |
13 #include "ash/wm/property_util.h" | 13 #include "ash/wm/property_util.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 15 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
16 #include "chrome/browser/lifetime/application_lifetime.h" | 16 #include "chrome/browser/lifetime/application_lifetime.h" |
17 #include "chrome/browser/ui/ash/caps_lock_handler.h" | |
18 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 17 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
19 #include "chrome/browser/ui/ash/event_rewriter.h" | 18 #include "chrome/browser/ui/ash/event_rewriter.h" |
20 #include "chrome/browser/ui/ash/screenshot_taker.h" | 19 #include "chrome/browser/ui/ash/screenshot_taker.h" |
21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
22 #include "ui/aura/aura_switches.h" | 21 #include "ui/aura/aura_switches.h" |
23 #include "ui/aura/display_manager.h" | 22 #include "ui/aura/display_manager.h" |
24 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
25 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
26 #include "ui/compositor/compositor_setup.h" | 25 #include "ui/compositor/compositor_setup.h" |
27 | 26 |
28 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
29 #include "base/chromeos/chromeos_version.h" | 28 #include "base/chromeos/chromeos_version.h" |
30 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | |
31 #include "chrome/browser/chromeos/login/user_manager.h" | 29 #include "chrome/browser/chromeos/login/user_manager.h" |
32 #include "chrome/browser/ui/ash/brightness_controller_chromeos.h" | 30 #include "chrome/browser/ui/ash/brightness_controller_chromeos.h" |
33 #include "chrome/browser/ui/ash/ime_controller_chromeos.h" | 31 #include "chrome/browser/ui/ash/ime_controller_chromeos.h" |
34 #include "chrome/browser/ui/ash/keyboard_brightness_controller_chromeos.h" | 32 #include "chrome/browser/ui/ash/keyboard_brightness_controller_chromeos.h" |
35 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" | 33 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" |
36 #endif | 34 #endif |
37 | 35 |
38 | 36 |
39 namespace chrome { | 37 namespace chrome { |
40 | 38 |
(...skipping 30 matching lines...) Expand all Loading... |
71 // Shell takes ownership of ChromeShellDelegate. | 69 // Shell takes ownership of ChromeShellDelegate. |
72 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); | 70 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); |
73 shell->event_rewriter_filter()->SetEventRewriterDelegate( | 71 shell->event_rewriter_filter()->SetEventRewriterDelegate( |
74 scoped_ptr<ash::EventRewriterDelegate>(new EventRewriter).Pass()); | 72 scoped_ptr<ash::EventRewriterDelegate>(new EventRewriter).Pass()); |
75 shell->accelerator_controller()->SetScreenshotDelegate( | 73 shell->accelerator_controller()->SetScreenshotDelegate( |
76 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); | 74 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); |
77 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
78 shell->accelerator_controller()->SetBrightnessControlDelegate( | 76 shell->accelerator_controller()->SetBrightnessControlDelegate( |
79 scoped_ptr<ash::BrightnessControlDelegate>( | 77 scoped_ptr<ash::BrightnessControlDelegate>( |
80 new BrightnessController).Pass()); | 78 new BrightnessController).Pass()); |
81 chromeos::input_method::XKeyboard* xkeyboard = | |
82 chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard(); | |
83 shell->accelerator_controller()->SetCapsLockDelegate( | |
84 scoped_ptr<ash::CapsLockDelegate>(new CapsLockHandler(xkeyboard)).Pass()); | |
85 shell->accelerator_controller()->SetImeControlDelegate( | 79 shell->accelerator_controller()->SetImeControlDelegate( |
86 scoped_ptr<ash::ImeControlDelegate>(new ImeController).Pass()); | 80 scoped_ptr<ash::ImeControlDelegate>(new ImeController).Pass()); |
87 shell->accelerator_controller()->SetKeyboardBrightnessControlDelegate( | 81 shell->accelerator_controller()->SetKeyboardBrightnessControlDelegate( |
88 scoped_ptr<ash::KeyboardBrightnessControlDelegate>( | 82 scoped_ptr<ash::KeyboardBrightnessControlDelegate>( |
89 new KeyboardBrightnessController).Pass()); | 83 new KeyboardBrightnessController).Pass()); |
90 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled( | 84 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled( |
91 chromeos::accessibility::IsHighContrastEnabled()); | 85 chromeos::accessibility::IsHighContrastEnabled()); |
92 | 86 |
93 ash::Shell::GetInstance()->magnification_controller()->SetEnabled( | 87 ash::Shell::GetInstance()->magnification_controller()->SetEnabled( |
94 chromeos::accessibility::IsScreenMagnifierEnabled()); | 88 chromeos::accessibility::IsScreenMagnifierEnabled()); |
95 | 89 |
96 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 90 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
97 switches::kDisableZeroBrowsersOpenForTests)) { | 91 switches::kDisableZeroBrowsersOpenForTests)) { |
98 browser::StartKeepAlive(); | 92 browser::StartKeepAlive(); |
99 } | 93 } |
100 #endif | 94 #endif |
101 ash::Shell::GetPrimaryRootWindow()->ShowRootWindow(); | 95 ash::Shell::GetPrimaryRootWindow()->ShowRootWindow(); |
102 } | 96 } |
103 | 97 |
104 void CloseAsh() { | 98 void CloseAsh() { |
105 if (ash::Shell::GetInstance()) | 99 if (ash::Shell::GetInstance()) |
106 ash::Shell::DeleteInstance(); | 100 ash::Shell::DeleteInstance(); |
107 } | 101 } |
108 | 102 |
109 } // namespace chrome | 103 } // namespace chrome |
OLD | NEW |