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

Side by Side Diff: chrome/browser/ui/ash/ash_init.cc

Issue 11364003: Fix the issue of cursor being shown at startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add tests Created 8 years, 1 month 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/chromeos/login/login_browsertest.cc ('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) 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"
(...skipping 26 matching lines...) Expand all
37 namespace chrome { 37 namespace chrome {
38 38
39 bool ShouldOpenAshOnStartup() { 39 bool ShouldOpenAshOnStartup() {
40 #if defined(OS_CHROMEOS) 40 #if defined(OS_CHROMEOS)
41 return true; 41 return true;
42 #endif 42 #endif
43 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too. 43 // TODO(scottmg): http://crbug.com/133312, will need this for Win8 too.
44 return false; 44 return false;
45 } 45 }
46 46
47 #if defined(OS_CHROMEOS)
48 // Returns true if the cursor should be initially hidden.
49 bool ShouldInitiallyHideCursor() {
50 if (base::chromeos::IsRunningOnChromeOS())
51 return !chromeos::UserManager::Get()->IsUserLoggedIn();
52 else
53 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager);
54 }
55 #endif
56
47 void OpenAsh() { 57 void OpenAsh() {
48 bool use_fullscreen = CommandLine::ForCurrentProcess()->HasSwitch( 58 bool use_fullscreen = CommandLine::ForCurrentProcess()->HasSwitch(
49 switches::kAuraHostWindowUseFullscreen); 59 switches::kAuraHostWindowUseFullscreen);
50 60
51 #if defined(OS_CHROMEOS) 61 #if defined(OS_CHROMEOS)
52 if (base::chromeos::IsRunningOnChromeOS()) { 62 if (base::chromeos::IsRunningOnChromeOS()) {
53 use_fullscreen = true; 63 use_fullscreen = true;
54 // Hides the cursor outside of the Aura root window. The cursor will be 64 // Hides the cursor outside of the Aura root window. The cursor will be
55 // drawn within the Aura root window, and it'll remain hidden after the 65 // drawn within the Aura root window, and it'll remain hidden after the
56 // Aura window is closed. 66 // Aura window is closed.
57 ui::HideHostCursor(); 67 ui::HideHostCursor();
58 } 68 }
69
70 // Hide the mouse cursor completely at boot.
71 if (ShouldInitiallyHideCursor())
72 ash::Shell::set_initially_hide_cursor(true);
59 #endif 73 #endif
60 if (use_fullscreen) { 74
75 if (use_fullscreen)
61 aura::SetUseFullscreenHostWindow(true); 76 aura::SetUseFullscreenHostWindow(true);
62 #if defined(OS_CHROMEOS) 77
63 // Hide the mouse cursor completely at boot.
64 if (!chromeos::UserManager::Get()->IsUserLoggedIn())
65 ash::Shell::set_initially_hide_cursor(true);
66 #endif
67 }
68 // Its easier to mark all windows as persisting and exclude the ones we care 78 // Its easier to mark all windows as persisting and exclude the ones we care
69 // about (browser windows), rather than explicitly excluding certain windows. 79 // about (browser windows), rather than explicitly excluding certain windows.
70 ash::SetDefaultPersistsAcrossAllWorkspaces(true); 80 ash::SetDefaultPersistsAcrossAllWorkspaces(true);
71 81
72 // Shell takes ownership of ChromeShellDelegate. 82 // Shell takes ownership of ChromeShellDelegate.
73 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate); 83 ash::Shell* shell = ash::Shell::CreateInstance(new ChromeShellDelegate);
74 shell->event_rewriter_filter()->SetEventRewriterDelegate( 84 shell->event_rewriter_filter()->SetEventRewriterDelegate(
75 scoped_ptr<ash::EventRewriterDelegate>(new EventRewriter).Pass()); 85 scoped_ptr<ash::EventRewriterDelegate>(new EventRewriter).Pass());
76 shell->accelerator_controller()->SetScreenshotDelegate( 86 shell->accelerator_controller()->SetScreenshotDelegate(
77 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass()); 87 scoped_ptr<ash::ScreenshotDelegate>(new ScreenshotTaker).Pass());
(...skipping 20 matching lines...) Expand all
98 #endif 108 #endif
99 ash::Shell::GetPrimaryRootWindow()->ShowRootWindow(); 109 ash::Shell::GetPrimaryRootWindow()->ShowRootWindow();
100 } 110 }
101 111
102 void CloseAsh() { 112 void CloseAsh() {
103 if (ash::Shell::HasInstance()) 113 if (ash::Shell::HasInstance())
104 ash::Shell::DeleteInstance(); 114 ash::Shell::DeleteInstance();
105 } 115 }
106 116
107 } // namespace chrome 117 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698