1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_
12 #include "base/compiler_specific.h"
13 #include "base/timer/timer.h"
14 #include "base/values.h"
15 #include "chrome/browser/signin/screenlock_bridge.h"
16 #include "components/user_manager/user.h"
17 #include "ui/wm/core/user_activity_observer.h"
21 class LoginDisplayWebUIHandler
;
23 // This class represents User Selection screen: user pod-based login screen.
24 class UserSelectionScreen
: public wm::UserActivityObserver
{
26 UserSelectionScreen();
27 virtual ~UserSelectionScreen();
29 static const user_manager::UserList
PrepareUserListForSending(
30 const user_manager::UserList
& users
,
32 bool is_signin_to_add
);
34 void SetHandler(LoginDisplayWebUIHandler
* handler
);
36 virtual void Init(const user_manager::UserList
& users
, bool show_guest
);
37 const user_manager::UserList
& GetUsers() const;
38 void OnUserImageChanged(const user_manager::User
& user
);
39 void OnBeforeUserRemoved(const std::string
& username
);
40 void OnUserRemoved(const std::string
& username
);
42 void OnPasswordClearTimerExpired();
43 virtual void SendUserList();
44 void HandleGetUsers();
45 void SetAuthType(const std::string
& username
,
46 ScreenlockBridge::LockHandler::AuthType auth_type
);
47 ScreenlockBridge::LockHandler::AuthType
GetAuthType(
48 const std::string
& username
) const;
50 // wm::UserActivityDetector implementation:
51 virtual void OnUserActivity(const ui::Event
* event
) OVERRIDE
;
53 // Fills |user_dict| with information about |user|.
54 static void FillUserDictionary(
55 user_manager::User
* user
,
57 bool is_signin_to_add
,
58 ScreenlockBridge::LockHandler::AuthType auth_type
,
59 const std::vector
<std::string
>* public_session_recommended_locales
,
60 base::DictionaryValue
* user_dict
);
62 // Determines if user auth status requires online sign in.
63 static bool ShouldForceOnlineSignIn(const user_manager::User
* user
);
66 LoginDisplayWebUIHandler
* handler_
;
68 // Map from public session user IDs to recommended locales set by policy.
69 typedef std::map
<std::string
, std::vector
<std::string
> >
70 PublicSessionRecommendedLocaleMap
;
71 PublicSessionRecommendedLocaleMap public_session_recommended_locales_
;
74 // Whether to show guest login.
77 // Set of Users that are visible.
78 user_manager::UserList users_
;
80 // Map of usernames to their current authentication type. If a user is not
81 // contained in the map, it is using the default authentication type.
82 std::map
<std::string
, ScreenlockBridge::LockHandler::AuthType
>
85 // Timer for measuring idle state duration before password clear.
86 base::OneShotTimer
<UserSelectionScreen
> password_clear_timer_
;
88 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen
);
91 } // namespace chromeos
93 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_