| 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/keyboard_overlay/keyboard_overlay_view.h" | 7 #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
| 8 #include "ash/system/chromeos/network/network_observer.h" | 8 #include "ash/system/chromeos/network/network_observer.h" |
| 9 #include "ash/system/tray/system_tray_notifier.h" | 9 #include "ash/system/tray/system_tray_notifier.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 11 #include "base/chromeos/chromeos_version.h" | |
| 12 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 13 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 14 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 16 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 17 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 16 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 18 #include "chrome/browser/chromeos/cros/cros_library.h" | 17 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 19 #include "chrome/browser/chromeos/cros/network_library.h" | 18 #include "chrome/browser/chromeos/cros/network_library.h" |
| 20 #include "chrome/browser/chromeos/display/display_preferences.h" | 19 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 21 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 20 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 36 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 38 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 37 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 39 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 38 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 40 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
| 43 #include "chromeos/chromeos_switches.h" | 42 #include "chromeos/chromeos_switches.h" |
| 44 #include "chromeos/dbus/dbus_thread_manager.h" | 43 #include "chromeos/dbus/dbus_thread_manager.h" |
| 45 #include "chromeos/dbus/power_manager_client.h" | 44 #include "chromeos/dbus/power_manager_client.h" |
| 46 #include "chromeos/dbus/session_manager_client.h" | 45 #include "chromeos/dbus/session_manager_client.h" |
| 46 #include "chromeos/login/login_state.h" |
| 47 #include "content/public/browser/user_metrics.h" | 47 #include "content/public/browser/user_metrics.h" |
| 48 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
| 49 #include "content/public/browser/web_contents_view.h" | 49 #include "content/public/browser/web_contents_view.h" |
| 50 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
| 51 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
| 52 | 52 |
| 53 bool ChromeShellDelegate::IsUserLoggedIn() const { | 53 bool ChromeShellDelegate::IsUserLoggedIn() const { |
| 54 // When running a Chrome OS build outside of a device (i.e. on a developer's | 54 return chromeos::LoginState::Get()->IsUserLoggedIn(); |
| 55 // workstation) and not running as login-manager, pretend like we're always | |
| 56 // logged in. | |
| 57 if (!base::chromeos::IsRunningOnChromeOS() && | |
| 58 !CommandLine::ForCurrentProcess()->HasSwitch( | |
| 59 chromeos::switches::kLoginManager)) { | |
| 60 return true; | |
| 61 } | |
| 62 | |
| 63 return chromeos::UserManager::Get()->IsUserLoggedIn(); | |
| 64 } | 55 } |
| 65 | 56 |
| 66 bool ChromeShellDelegate::IsSessionStarted() const { | 57 bool ChromeShellDelegate::IsSessionStarted() const { |
| 67 // Returns true if we're logged in and browser has been started | 58 return chromeos::LoginState::Get()->IsSessionStarted(); |
| 68 return chromeos::UserManager::Get()->IsSessionStarted(); | |
| 69 } | 59 } |
| 70 | 60 |
| 71 bool ChromeShellDelegate::IsGuestSession() const { | 61 bool ChromeShellDelegate::IsGuestSession() const { |
| 72 return CommandLine::ForCurrentProcess()->HasSwitch( | 62 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 73 chromeos::switches::kGuestSession); | 63 chromeos::switches::kGuestSession); |
| 74 } | 64 } |
| 75 | 65 |
| 76 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | 66 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
| 77 return CommandLine::ForCurrentProcess()->HasSwitch( | 67 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 78 chromeos::switches::kFirstBoot); | 68 chromeos::switches::kFirstBoot); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 291 } |
| 302 | 292 |
| 303 void ChromeShellDelegate::PlatformInit() { | 293 void ChromeShellDelegate::PlatformInit() { |
| 304 registrar_.Add(this, | 294 registrar_.Add(this, |
| 305 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 295 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 306 content::NotificationService::AllSources()); | 296 content::NotificationService::AllSources()); |
| 307 registrar_.Add(this, | 297 registrar_.Add(this, |
| 308 chrome::NOTIFICATION_SESSION_STARTED, | 298 chrome::NOTIFICATION_SESSION_STARTED, |
| 309 content::NotificationService::AllSources()); | 299 content::NotificationService::AllSources()); |
| 310 } | 300 } |
| OLD | NEW |