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

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

Issue 13495003: Add LoginState class to src/chromeos/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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
« no previous file with comments | « chrome/browser/ui/ash/ash_init.cc ('k') | chrome/browser/ui/webui/screenshot_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/file_manager_util.h" 20 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h"
(...skipping 15 matching lines...) Expand all
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 // Returns true if we're logged in and browser has been started
68 return chromeos::UserManager::Get()->IsSessionStarted(); 59 return chromeos::UserManager::Get()->IsSessionStarted();
69 } 60 }
70 61
71 bool ChromeShellDelegate::IsGuestSession() const { 62 bool ChromeShellDelegate::IsGuestSession() const {
72 return CommandLine::ForCurrentProcess()->HasSwitch( 63 return CommandLine::ForCurrentProcess()->HasSwitch(
73 chromeos::switches::kGuestSession); 64 chromeos::switches::kGuestSession);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 292 }
302 293
303 void ChromeShellDelegate::PlatformInit() { 294 void ChromeShellDelegate::PlatformInit() {
304 registrar_.Add(this, 295 registrar_.Add(this,
305 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 296 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
306 content::NotificationService::AllSources()); 297 content::NotificationService::AllSources());
307 registrar_.Add(this, 298 registrar_.Add(this,
308 chrome::NOTIFICATION_SESSION_STARTED, 299 chrome::NOTIFICATION_SESSION_STARTED,
309 content::NotificationService::AllSources()); 300 content::NotificationService::AllSources());
310 } 301 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/ash_init.cc ('k') | chrome/browser/ui/webui/screenshot_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698