OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include "ash/accelerators/magnifier_key_scroller.h" | 7 #include "ash/accelerators/magnifier_key_scroller.h" |
8 #include "ash/accelerators/spoken_feedback_toggler.h" | 8 #include "ash/accelerators/spoken_feedback_toggler.h" |
9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
10 #include "ash/wm/mru_window_tracker.h" | 10 #include "ash/wm/mru_window_tracker.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/grit/generated_resources.h" | 35 #include "chrome/grit/generated_resources.h" |
36 #include "chromeos/chromeos_switches.h" | 36 #include "chromeos/chromeos_switches.h" |
37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
38 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
39 #include "ui/aura/window.h" | 39 #include "ui/aura/window.h" |
40 #include "ui/base/ime/chromeos/input_method_manager.h" | 40 #include "ui/base/ime/chromeos/input_method_manager.h" |
41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 void InitAfterSessionStart() { | 45 void InitAfterFirstSessionStart() { |
46 // Restore focus after the user session is started. It's needed because some | 46 // Restore focus after the user session is started. It's needed because some |
47 // windows can be opened in background while login UI is still active because | 47 // windows can be opened in background while login UI is still active because |
48 // we currently restore browser windows before login UI is deleted. | 48 // we currently restore browser windows before login UI is deleted. |
49 ash::Shell* shell = ash::Shell::GetInstance(); | 49 ash::Shell* shell = ash::Shell::GetInstance(); |
50 ash::MruWindowTracker::WindowList mru_list = | 50 ash::MruWindowTracker::WindowList mru_list = |
51 shell->mru_window_tracker()->BuildMruWindowList(); | 51 shell->mru_window_tracker()->BuildMruWindowList(); |
52 if (!mru_list.empty()) | 52 if (!mru_list.empty()) |
53 mru_list.front()->Focus(); | 53 mru_list.front()->Focus(); |
54 | 54 |
55 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode. | 55 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 if (!chromeos::ProfileHelper::IsSigninProfile(profile) && | 256 if (!chromeos::ProfileHelper::IsSigninProfile(profile) && |
257 !profile->IsGuestSession() && !profile->IsSupervised()) { | 257 !profile->IsGuestSession() && !profile->IsSupervised()) { |
258 // Start the error notifier services to show auth/sync notifications. | 258 // Start the error notifier services to show auth/sync notifications. |
259 SigninErrorNotifierFactory::GetForProfile(profile); | 259 SigninErrorNotifierFactory::GetForProfile(profile); |
260 SyncErrorNotifierFactory::GetForProfile(profile); | 260 SyncErrorNotifierFactory::GetForProfile(profile); |
261 } | 261 } |
262 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 262 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
263 break; | 263 break; |
264 } | 264 } |
265 case chrome::NOTIFICATION_SESSION_STARTED: | 265 case chrome::NOTIFICATION_SESSION_STARTED: |
266 InitAfterSessionStart(); | 266 // InitAfterFirstSessionStart() should only be called once upon system |
| 267 // start. |
| 268 if (user_manager::UserManager::Get()->GetLoggedInUsers().size() < 2) |
| 269 InitAfterFirstSessionStart(); |
267 ash::Shell::GetInstance()->ShowShelf(); | 270 ash::Shell::GetInstance()->ShowShelf(); |
268 break; | 271 break; |
269 default: | 272 default: |
270 NOTREACHED() << "Unexpected notification " << type; | 273 NOTREACHED() << "Unexpected notification " << type; |
271 } | 274 } |
272 } | 275 } |
273 | 276 |
274 void ChromeShellDelegate::PlatformInit() { | 277 void ChromeShellDelegate::PlatformInit() { |
275 registrar_.Add(this, | 278 registrar_.Add(this, |
276 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 279 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
277 content::NotificationService::AllSources()); | 280 content::NotificationService::AllSources()); |
278 registrar_.Add(this, | 281 registrar_.Add(this, |
279 chrome::NOTIFICATION_SESSION_STARTED, | 282 chrome::NOTIFICATION_SESSION_STARTED, |
280 content::NotificationService::AllSources()); | 283 content::NotificationService::AllSources()); |
281 } | 284 } |
OLD | NEW |