Chromium Code Reviews| Index: chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| index 36e3f4b47c1c615f422021bac89d84753d35232d..87ddc280b6217a6682c539f5bac2435a767c47f4 100644 |
| --- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| +++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc |
| @@ -7,6 +7,7 @@ |
| #include "apps/native_app_window.h" |
| #include "apps/shell_window_registry.h" |
| #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
| +#include "ash/wm/mru_window_tracker.h" |
| #include "ash/wm/window_util.h" |
| #include "base/command_line.h" |
| #include "base/prefs/pref_service.h" |
| @@ -43,6 +44,21 @@ |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_view.h" |
| +namespace { |
| + |
| +// This function used for restoring focus after user session was started. |
|
James Cook
2013/08/21 16:31:49
nit: "This function is used for restoring focus af
Nikita (slow)
2013/08/21 17:23:25
Done.
|
| +// It's needed because some windows can be opened in background while login UI |
| +// is still active because we currently restore browser windows before login UI |
| +// is deleted. |
| +void RestoreFocus() { |
| + ash::MruWindowTracker::WindowList mru_list = |
| + ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList(); |
| + if (!mru_list.empty()) |
| + mru_list.front()->Focus(); |
| +} |
| + |
| +} // anonymous namespace |
| + |
| bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
| return CommandLine::ForCurrentProcess()->HasSwitch( |
| chromeos::switches::kFirstExecAfterBoot); |
| @@ -243,6 +259,7 @@ void ChromeShellDelegate::Observe(int type, |
| ash::Shell::GetInstance()->CreateLauncher(); |
| break; |
| case chrome::NOTIFICATION_SESSION_STARTED: |
| + RestoreFocus(); |
| ash::Shell::GetInstance()->ShowLauncher(); |
| break; |
| default: |