| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/ui/ash/window_positioner.h" | 33 #include "chrome/browser/ui/ash/window_positioner.h" |
| 34 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 35 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
| 36 #include "chrome/browser/ui/browser_window.h" | 36 #include "chrome/browser/ui/browser_window.h" |
| 37 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 37 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 38 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 38 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 39 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 39 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 40 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 43 #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" |
| 47 #include "content/public/browser/user_metrics.h" | 46 #include "content/public/browser/user_metrics.h" |
| 48 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
| 49 #include "content/public/browser/web_contents_view.h" | 48 #include "content/public/browser/web_contents_view.h" |
| 50 #include "grit/generated_resources.h" | 49 #include "grit/generated_resources.h" |
| 51 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
| 52 | 51 |
| 53 bool ChromeShellDelegate::IsUserLoggedIn() const { | 52 bool ChromeShellDelegate::IsUserLoggedIn() const { |
| 54 // When running a Chrome OS build outside of a device (i.e. on a developer's | 53 // When running a Chrome OS build outside of a device (i.e. on a developer's |
| 55 // workstation) and not running as login-manager, pretend like we're always | 54 // workstation) and not running as login-manager, pretend like we're always |
| 56 // logged in. | 55 // logged in. |
| 57 if (!base::chromeos::IsRunningOnChromeOS() && | 56 if (!base::chromeos::IsRunningOnChromeOS() && |
| 58 !CommandLine::ForCurrentProcess()->HasSwitch( | 57 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { |
| 59 chromeos::switches::kLoginManager)) { | |
| 60 return true; | 58 return true; |
| 61 } | 59 } |
| 62 | 60 |
| 63 return chromeos::UserManager::Get()->IsUserLoggedIn(); | 61 return chromeos::UserManager::Get()->IsUserLoggedIn(); |
| 64 } | 62 } |
| 65 | 63 |
| 66 bool ChromeShellDelegate::IsSessionStarted() const { | 64 bool ChromeShellDelegate::IsSessionStarted() const { |
| 67 // Returns true if we're logged in and browser has been started | 65 // Returns true if we're logged in and browser has been started |
| 68 return chromeos::UserManager::Get()->IsSessionStarted(); | 66 return chromeos::UserManager::Get()->IsSessionStarted(); |
| 69 } | 67 } |
| 70 | 68 |
| 71 bool ChromeShellDelegate::IsGuestSession() const { | 69 bool ChromeShellDelegate::IsGuestSession() const { |
| 72 return CommandLine::ForCurrentProcess()->HasSwitch( | 70 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
| 73 chromeos::switches::kGuestSession); | |
| 74 } | 71 } |
| 75 | 72 |
| 76 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | 73 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
| 77 return CommandLine::ForCurrentProcess()->HasSwitch( | 74 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot); |
| 78 chromeos::switches::kFirstBoot); | |
| 79 } | 75 } |
| 80 | 76 |
| 81 bool ChromeShellDelegate::CanLockScreen() const { | 77 bool ChromeShellDelegate::CanLockScreen() const { |
| 82 return chromeos::UserManager::Get()->CanCurrentUserLock(); | 78 return chromeos::UserManager::Get()->CanCurrentUserLock(); |
| 83 } | 79 } |
| 84 | 80 |
| 85 void ChromeShellDelegate::LockScreen() { | 81 void ChromeShellDelegate::LockScreen() { |
| 86 if (CanLockScreen()) { | 82 if (CanLockScreen()) { |
| 87 // TODO(antrim) : additional logging for crbug/173178 | 83 // TODO(antrim) : additional logging for crbug/173178 |
| 88 LOG(WARNING) << "Requesting screen lock from ChromeShellDelegate"; | 84 LOG(WARNING) << "Requesting screen lock from ChromeShellDelegate"; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 297 } |
| 302 | 298 |
| 303 void ChromeShellDelegate::PlatformInit() { | 299 void ChromeShellDelegate::PlatformInit() { |
| 304 registrar_.Add(this, | 300 registrar_.Add(this, |
| 305 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 301 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 306 content::NotificationService::AllSources()); | 302 content::NotificationService::AllSources()); |
| 307 registrar_.Add(this, | 303 registrar_.Add(this, |
| 308 chrome::NOTIFICATION_SESSION_STARTED, | 304 chrome::NOTIFICATION_SESSION_STARTED, |
| 309 content::NotificationService::AllSources()); | 305 content::NotificationService::AllSources()); |
| 310 } | 306 } |
| OLD | NEW |