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" | |
8 #include "ash/ash_switches.h" | |
9 #include "ash/shell.h" | |
10 #include "base/command_line.h" | |
11 #include "chrome/common/chrome_switches.h" | |
12 #include "chrome/browser/ui/views/ash/caps_lock_handler.h" | |
13 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" | |
14 #include "chrome/browser/ui/views/ash/screen_orientation_listener.h" | |
15 #include "chrome/browser/ui/views/ash/screenshot_taker.h" | |
16 #include "chrome/browser/ui/views/ash/status_area_host_aura.h" | |
17 #include "ui/aura/env.h" | 7 #include "ui/aura/env.h" |
18 #include "ui/aura/aura_switches.h" | |
19 #include "ui/aura/root_window.h" | |
20 #include "ui/gfx/compositor/compositor_setup.h" | |
21 | |
22 #if defined(OS_CHROMEOS) | |
23 #include "chrome/browser/ui/views/ash/brightness_controller_chromeos.h" | |
24 #include "chrome/browser/ui/views/ash/ime_controller_chromeos.h" | |
25 #include "chrome/browser/ui/views/ash/volume_controller_chromeos.h" | |
26 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | |
27 #include "chrome/browser/chromeos/login/user_manager.h" | |
28 #include "chrome/browser/chromeos/system/runtime_environment.h" | |
29 #endif | |
30 | 8 |
31 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() | 9 ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura() |
32 : ChromeBrowserMainExtraParts() { | 10 : ChromeBrowserMainExtraParts() { |
33 } | 11 } |
34 | 12 |
35 void ChromeBrowserMainExtraPartsAura::PreProfileInit() { | |
36 #if defined(OS_CHROMEOS) | |
sky
2012/03/13 23:49:11
Where did all of this code end up?
Elliot Glaysher
2012/03/13 23:51:25
In the ash file right next to it? This file was sp
| |
37 if (chromeos::system::runtime_environment::IsRunningOnChromeOS() || | |
38 CommandLine::ForCurrentProcess()->HasSwitch( | |
39 switches::kAuraHostWindowUseFullscreen)) { | |
40 aura::RootWindow::set_use_fullscreen_host_window(true); | |
41 aura::RootWindow::set_hide_host_cursor(true); | |
42 // Hide the mouse cursor completely at boot. | |
43 if (!chromeos::UserManager::Get()->IsUserLoggedIn()) | |
44 ash::Shell::set_initially_hide_cursor(true); | |
45 } | |
46 #endif | |
47 | |
48 // Shell takes ownership of ChromeShellDelegate. | |
49 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); | |
50 shell->accelerator_controller()->SetScreenshotDelegate( | |
51 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); | |
52 #if defined(OS_CHROMEOS) | |
53 shell->accelerator_controller()->SetBrightnessControlDelegate( | |
54 scoped_ptr<ash::BrightnessControlDelegate>( | |
55 new BrightnessController).Pass()); | |
56 chromeos::input_method::XKeyboard* xkeyboard = | |
57 chromeos::input_method::InputMethodManager::GetInstance()->GetXKeyboard(); | |
58 shell->accelerator_controller()->SetCapsLockDelegate( | |
59 scoped_ptr<ash::CapsLockDelegate>(new CapsLockHandler(xkeyboard)).Pass()); | |
60 shell->accelerator_controller()->SetImeControlDelegate( | |
61 scoped_ptr<ash::ImeControlDelegate>(new ImeController).Pass()); | |
62 shell->accelerator_controller()->SetVolumeControlDelegate( | |
63 scoped_ptr<ash::VolumeControlDelegate>(new VolumeController).Pass()); | |
64 #endif | |
65 | |
66 // Make sure the singleton ScreenOrientationListener object is created. | |
67 ScreenOrientationListener::GetInstance(); | |
68 } | |
69 | |
70 void ChromeBrowserMainExtraPartsAura::PostProfileInit() { | |
71 // Add the status area buttons after Profile has been initialized. | |
72 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
73 ash::switches::kAshUberTray)) { | |
74 ChromeShellDelegate::instance()->status_area_host()->AddButtons(); | |
75 } | |
76 } | |
77 | |
78 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { | 13 void ChromeBrowserMainExtraPartsAura::PostMainMessageLoopRun() { |
79 ash::Shell::DeleteInstance(); | |
80 aura::Env::DeleteInstance(); | 14 aura::Env::DeleteInstance(); |
81 } | 15 } |
OLD | NEW |