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..2b0511b1052344a586591a73027183dc2cca6426 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,20 @@ |
| #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. |
| +// It's needed because some windows can be opened in background while login UI |
|
oshima
2013/08/20 14:56:01
because we currently restore browser windows befor
Nikita (slow)
2013/08/20 16:04:39
Done.
|
| +// is still active. |
| +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 +258,7 @@ void ChromeShellDelegate::Observe(int type, |
| ash::Shell::GetInstance()->CreateLauncher(); |
| break; |
| case chrome::NOTIFICATION_SESSION_STARTED: |
| + RestoreFocus(); |
| ash::Shell::GetInstance()->ShowLauncher(); |
| break; |
| default: |