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

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

Issue 22887021: Pass focus to browser after login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 4 months 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
OLDNEW
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 "apps/native_app_window.h" 7 #include "apps/native_app_window.h"
8 #include "apps/shell_window_registry.h" 8 #include "apps/shell_window_registry.h"
9 #include "ash/keyboard_overlay/keyboard_overlay_view.h" 9 #include "ash/keyboard_overlay/keyboard_overlay_view.h"
10 #include "ash/wm/mru_window_tracker.h"
10 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
13 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 16 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
16 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" 17 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h"
17 #include "chrome/browser/chromeos/display/display_preferences.h" 18 #include "chrome/browser/chromeos/display/display_preferences.h"
18 #include "chrome/browser/chromeos/extensions/file_manager/app_id.h" 19 #include "chrome/browser/chromeos/extensions/file_manager/app_id.h"
19 #include "chrome/browser/chromeos/extensions/media_player_api.h" 20 #include "chrome/browser/chromeos/extensions/media_player_api.h"
(...skipping 16 matching lines...) Expand all
36 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
37 #include "chromeos/chromeos_switches.h" 38 #include "chromeos/chromeos_switches.h"
38 #include "chromeos/dbus/dbus_thread_manager.h" 39 #include "chromeos/dbus/dbus_thread_manager.h"
39 #include "chromeos/dbus/power_manager_client.h" 40 #include "chromeos/dbus/power_manager_client.h"
40 #include "chromeos/ime/input_method_manager.h" 41 #include "chromeos/ime/input_method_manager.h"
41 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
42 #include "content/public/browser/user_metrics.h" 43 #include "content/public/browser/user_metrics.h"
43 #include "content/public/browser/web_contents.h" 44 #include "content/public/browser/web_contents.h"
44 #include "content/public/browser/web_contents_view.h" 45 #include "content/public/browser/web_contents_view.h"
45 46
47 namespace {
48
49 // This function is used for restoring focus after the user session is started.
50 // It's needed because some windows can be opened in background while login UI
51 // is still active because we currently restore browser windows before login UI
52 // is deleted.
53 void RestoreFocus() {
54 ash::MruWindowTracker::WindowList mru_list =
55 ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList();
56 if (!mru_list.empty())
57 mru_list.front()->Focus();
58 }
59
60 } // anonymous namespace
61
46 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { 62 bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
47 return CommandLine::ForCurrentProcess()->HasSwitch( 63 return CommandLine::ForCurrentProcess()->HasSwitch(
48 chromeos::switches::kFirstExecAfterBoot); 64 chromeos::switches::kFirstExecAfterBoot);
49 } 65 }
50 66
51 void ChromeShellDelegate::PreInit() { 67 void ChromeShellDelegate::PreInit() {
52 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); 68 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot());
53 } 69 }
54 70
55 void ChromeShellDelegate::Shutdown() { 71 void ChromeShellDelegate::Shutdown() {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 252 }
237 253
238 void ChromeShellDelegate::Observe(int type, 254 void ChromeShellDelegate::Observe(int type,
239 const content::NotificationSource& source, 255 const content::NotificationSource& source,
240 const content::NotificationDetails& details) { 256 const content::NotificationDetails& details) {
241 switch (type) { 257 switch (type) {
242 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: 258 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED:
243 ash::Shell::GetInstance()->CreateLauncher(); 259 ash::Shell::GetInstance()->CreateLauncher();
244 break; 260 break;
245 case chrome::NOTIFICATION_SESSION_STARTED: 261 case chrome::NOTIFICATION_SESSION_STARTED:
262 RestoreFocus();
246 ash::Shell::GetInstance()->ShowLauncher(); 263 ash::Shell::GetInstance()->ShowLauncher();
247 break; 264 break;
248 default: 265 default:
249 NOTREACHED() << "Unexpected notification " << type; 266 NOTREACHED() << "Unexpected notification " << type;
250 } 267 }
251 } 268 }
252 269
253 void ChromeShellDelegate::PlatformInit() { 270 void ChromeShellDelegate::PlatformInit() {
254 registrar_.Add(this, 271 registrar_.Add(this,
255 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 272 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
256 content::NotificationService::AllSources()); 273 content::NotificationService::AllSources());
257 registrar_.Add(this, 274 registrar_.Add(this,
258 chrome::NOTIFICATION_SESSION_STARTED, 275 chrome::NOTIFICATION_SESSION_STARTED,
259 content::NotificationService::AllSources()); 276 content::NotificationService::AllSources());
260 } 277 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_adding_screen_browsertest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698