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

Side by Side Diff: chrome/browser/chromeos/power/power_button_observer.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/power/power_button_observer.h" 5 #include "chrome/browser/chromeos/power/power_button_observer.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray_delegate.h"
8 #include "ash/system/user/login_status.h" 9 #include "ash/system/user/login_status.h"
9 #include "ash/wm/power_button_controller.h" 10 #include "ash/wm/power_button_controller.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "chrome/browser/chromeos/login/screen_locker.h" 12 #include "chrome/browser/chromeos/login/screen_locker.h"
12 #include "chrome/browser/chromeos/login/user.h"
13 #include "chrome/browser/chromeos/login/user_manager.h"
14 #include "chrome/browser/chromeos/power/session_state_controller_delegate_chrome os.h" 13 #include "chrome/browser/chromeos/power/session_state_controller_delegate_chrome os.h"
15 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 15 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "content/public/browser/notification_service.h" 16 #include "content/public/browser/notification_service.h"
18 17
19 namespace chromeos { 18 namespace chromeos {
20 19
21 namespace { 20 namespace {
22 21
23 ash::user::LoginStatus GetCurrentLoginStatus() { 22 ash::user::LoginStatus GetCurrentLoginStatus() {
24 const UserManager* user_manager = UserManager::Get(); 23 if (!ash::Shell::GetInstance()->system_tray_delegate())
25 if (!user_manager->IsUserLoggedIn()) 24 return ash::user::LOGGED_IN_NONE;
bartfab (slow) 2013/04/08 15:18:36 The double space after return is still there.
stevenjb 2013/04/09 15:12:26 Done.
26 return ash::user::LOGGED_IN_NONE; 25 return ash::Shell::GetInstance()->system_tray_delegate()->
27 if (user_manager->IsCurrentUserOwner()) 26 GetUserLoginStatus();
28 return ash::user::LOGGED_IN_OWNER;
29
30 switch (user_manager->GetLoggedInUser()->GetType()) {
31 case User::USER_TYPE_REGULAR:
32 return ash::user::LOGGED_IN_USER;
33 case User::USER_TYPE_GUEST:
34 return ash::user::LOGGED_IN_GUEST;
35 case User::USER_TYPE_RETAIL_MODE:
36 return ash::user::LOGGED_IN_RETAIL_MODE;
37 case User::USER_TYPE_PUBLIC_ACCOUNT:
38 return ash::user::LOGGED_IN_PUBLIC;
39 case User::USER_TYPE_LOCALLY_MANAGED:
40 return ash::user::LOGGED_IN_LOCALLY_MANAGED;
41 case User::USER_TYPE_KIOSK_APP:
42 return ash::user::LOGGED_IN_KIOSK_APP;
43 }
44
45 NOTREACHED();
46 return ash::user::LOGGED_IN_USER;
47 } 27 }
48 28
49 } // namespace 29 } // namespace
50 30
51 PowerButtonObserver::PowerButtonObserver() { 31 PowerButtonObserver::PowerButtonObserver() {
52 ash::Shell::GetInstance()->session_state_controller()-> 32 ash::Shell::GetInstance()->session_state_controller()->
53 SetDelegate(new SessionStateControllerDelegateChromeos); 33 SetDelegate(new SessionStateControllerDelegateChromeos);
54 34
55 registrar_.Add( 35 registrar_.Add(
56 this, 36 this,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool down, const base::TimeTicks& timestamp) { 86 bool down, const base::TimeTicks& timestamp) {
107 ash::Shell::GetInstance()->power_button_controller()-> 87 ash::Shell::GetInstance()->power_button_controller()->
108 OnPowerButtonEvent(down, timestamp); 88 OnPowerButtonEvent(down, timestamp);
109 } 89 }
110 90
111 void PowerButtonObserver::LockScreen() { 91 void PowerButtonObserver::LockScreen() {
112 ash::Shell::GetInstance()->session_state_controller()->OnStartingLock(); 92 ash::Shell::GetInstance()->session_state_controller()->OnStartingLock();
113 } 93 }
114 94
115 } // namespace chromeos 95 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/wimax_config_view.cc ('k') | chrome/browser/chromeos/status/data_promo_notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698