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 InitAfterSessionStart(bool is_first_run) { |
Mr4D (OOO till 08-26)
2015/04/14 20:06:55
You can remove this.
| |
46 if (!is_first_run) | |
47 return; | |
48 | |
46 // Restore focus after the user session is started. It's needed because some | 49 // 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 | 50 // windows can be opened in background while login UI is still active because |
48 // we currently restore browser windows before login UI is deleted. | 51 // we currently restore browser windows before login UI is deleted. |
49 ash::Shell* shell = ash::Shell::GetInstance(); | 52 ash::Shell* shell = ash::Shell::GetInstance(); |
50 ash::MruWindowTracker::WindowList mru_list = | 53 ash::MruWindowTracker::WindowList mru_list = |
51 shell->mru_window_tracker()->BuildMruWindowList(); | 54 shell->mru_window_tracker()->BuildMruWindowList(); |
52 if (!mru_list.empty()) | 55 if (!mru_list.empty()) |
53 mru_list.front()->Focus(); | 56 mru_list.front()->Focus(); |
54 | 57 |
55 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode. | 58 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 Profile* profile = content::Details<Profile>(details).ptr(); | 258 Profile* profile = content::Details<Profile>(details).ptr(); |
256 if (!chromeos::ProfileHelper::IsSigninProfile(profile) && | 259 if (!chromeos::ProfileHelper::IsSigninProfile(profile) && |
257 !profile->IsGuestSession() && !profile->IsSupervised()) { | 260 !profile->IsGuestSession() && !profile->IsSupervised()) { |
258 // Start the error notifier services to show auth/sync notifications. | 261 // Start the error notifier services to show auth/sync notifications. |
259 SigninErrorNotifierFactory::GetForProfile(profile); | 262 SigninErrorNotifierFactory::GetForProfile(profile); |
260 SyncErrorNotifierFactory::GetForProfile(profile); | 263 SyncErrorNotifierFactory::GetForProfile(profile); |
261 } | 264 } |
262 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); | 265 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); |
263 break; | 266 break; |
264 } | 267 } |
265 case chrome::NOTIFICATION_SESSION_STARTED: | 268 case chrome::NOTIFICATION_SESSION_STARTED: |
Mr4D (OOO till 08-26)
2015/04/14 20:06:55
Do not call this function in the first place when
| |
266 InitAfterSessionStart(); | 269 InitAfterSessionStart(is_first_run_); |
Mr4D (OOO till 08-26)
2015/04/14 20:06:55
You don't even need is_first_run_ by using:
| |
270 is_first_run_ = false; | |
267 ash::Shell::GetInstance()->ShowShelf(); | 271 ash::Shell::GetInstance()->ShowShelf(); |
268 break; | 272 break; |
269 default: | 273 default: |
270 NOTREACHED() << "Unexpected notification " << type; | 274 NOTREACHED() << "Unexpected notification " << type; |
271 } | 275 } |
272 } | 276 } |
273 | 277 |
274 void ChromeShellDelegate::PlatformInit() { | 278 void ChromeShellDelegate::PlatformInit() { |
275 registrar_.Add(this, | 279 registrar_.Add(this, |
276 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 280 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
277 content::NotificationService::AllSources()); | 281 content::NotificationService::AllSources()); |
278 registrar_.Add(this, | 282 registrar_.Add(this, |
279 chrome::NOTIFICATION_SESSION_STARTED, | 283 chrome::NOTIFICATION_SESSION_STARTED, |
280 content::NotificationService::AllSources()); | 284 content::NotificationService::AllSources()); |
281 } | 285 } |
OLD | NEW |