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