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/magnifier/partial_magnification_controller.h" | 11 #include "ash/magnifier/partial_magnification_controller.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/wm/event_rewriter_event_filter.h" | 13 #include "ash/wm/event_rewriter_event_filter.h" |
14 #include "ash/wm/property_util.h" | 14 #include "ash/wm/property_util.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "chrome/browser/browser_shutdown.h" | 16 #include "chrome/browser/browser_shutdown.h" |
17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
18 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 18 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
19 #include "chrome/browser/lifetime/application_lifetime.h" | 19 #include "chrome/browser/lifetime/application_lifetime.h" |
20 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 20 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
21 #include "chrome/browser/ui/ash/event_rewriter.h" | 21 #include "chrome/browser/ui/ash/event_rewriter.h" |
22 #include "chrome/browser/ui/ash/screenshot_taker.h" | 22 #include "chrome/browser/ui/ash/screenshot_taker.h" |
23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
24 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
25 #include "ui/aura/root_window.h" | 25 #include "ui/aura/root_window.h" |
26 #include "ui/compositor/compositor_setup.h" | 26 #include "ui/compositor/compositor_setup.h" |
27 | 27 |
28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
29 #include "base/chromeos/chromeos_version.h" | 29 #include "base/chromeos/chromeos_version.h" |
30 #include "chrome/browser/chromeos/login/user_manager.h" | |
31 #include "chrome/browser/ui/ash/brightness_controller_chromeos.h" | 30 #include "chrome/browser/ui/ash/brightness_controller_chromeos.h" |
32 #include "chrome/browser/ui/ash/ime_controller_chromeos.h" | 31 #include "chrome/browser/ui/ash/ime_controller_chromeos.h" |
33 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" | 32 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" |
34 #include "chromeos/chromeos_switches.h" | 33 #include "chromeos/chromeos_switches.h" |
| 34 #include "chromeos/login/login_state.h" |
35 #include "ui/base/x/x11_util.h" | 35 #include "ui/base/x/x11_util.h" |
36 #endif | 36 #endif |
37 | 37 |
38 namespace chrome { | 38 namespace chrome { |
39 | 39 |
40 bool ShouldOpenAshOnStartup() { | 40 bool ShouldOpenAshOnStartup() { |
41 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
42 return true; | 42 return true; |
43 #endif | 43 #endif |
44 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too. | 44 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too. |
45 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh); | 45 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOpenAsh); |
46 } | 46 } |
47 | 47 |
48 #if defined(OS_CHROMEOS) | |
49 // Returns true if the cursor should be initially hidden. | |
50 bool ShouldInitiallyHideCursor() { | |
51 if (base::chromeos::IsRunningOnChromeOS()) | |
52 return !chromeos::UserManager::Get()->IsUserLoggedIn(); | |
53 else | |
54 return CommandLine::ForCurrentProcess()->HasSwitch( | |
55 chromeos::switches::kLoginManager); | |
56 } | |
57 #endif | |
58 | |
59 void OpenAsh() { | 48 void OpenAsh() { |
60 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
61 if (base::chromeos::IsRunningOnChromeOS()) { | 50 if (base::chromeos::IsRunningOnChromeOS()) { |
62 // Hides the cursor outside of the Aura root window. The cursor will be | 51 // Hides the cursor outside of the Aura root window. The cursor will be |
63 // drawn within the Aura root window, and it'll remain hidden after the | 52 // drawn within the Aura root window, and it'll remain hidden after the |
64 // Aura window is closed. | 53 // Aura window is closed. |
65 ui::HideHostCursor(); | 54 ui::HideHostCursor(); |
66 } | 55 } |
67 | 56 |
68 // Hide the mouse cursor completely at boot. | 57 // Hide the mouse cursor completely at boot. |
69 if (ShouldInitiallyHideCursor()) | 58 if (!chromeos::LoginState::Get()->IsUserLoggedIn()) |
70 ash::Shell::set_initially_hide_cursor(true); | 59 ash::Shell::set_initially_hide_cursor(true); |
71 #endif | 60 #endif |
72 | 61 |
73 // Its easier to mark all windows as persisting and exclude the ones we care | 62 // Its easier to mark all windows as persisting and exclude the ones we care |
74 // about (browser windows), rather than explicitly excluding certain windows. | 63 // about (browser windows), rather than explicitly excluding certain windows. |
75 ash::SetDefaultPersistsAcrossAllWorkspaces(true); | 64 ash::SetDefaultPersistsAcrossAllWorkspaces(true); |
76 | 65 |
77 // Shell takes ownership of ChromeShellDelegate. | 66 // Shell takes ownership of ChromeShellDelegate. |
78 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); | 67 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); |
79 shell->event_rewriter_filter()->SetEventRewriterDelegate( | 68 shell->event_rewriter_filter()->SetEventRewriterDelegate( |
(...skipping 30 matching lines...) Expand all Loading... |
110 void CloseAsh() { | 99 void CloseAsh() { |
111 // If shutdown is initiated by |BrowserX11IOErrorHandler|, don't | 100 // If shutdown is initiated by |BrowserX11IOErrorHandler|, don't |
112 // try to cleanup resources. | 101 // try to cleanup resources. |
113 if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers() && | 102 if (!browser_shutdown::ShuttingDownWithoutClosingBrowsers() && |
114 ash::Shell::HasInstance()) { | 103 ash::Shell::HasInstance()) { |
115 ash::Shell::DeleteInstance(); | 104 ash::Shell::DeleteInstance(); |
116 } | 105 } |
117 } | 106 } |
118 | 107 |
119 } // namespace chrome | 108 } // namespace chrome |
OLD | NEW |