| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/bind.h" | |
| 12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 13 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 14 #include "base/values.h" | 13 #include "base/values.h" |
| 15 #include "chrome/browser/signin/screenlock_bridge.h" | 14 #include "chrome/browser/signin/screenlock_bridge.h" |
| 16 #include "components/user_manager/user.h" | 15 #include "components/user_manager/user.h" |
| 17 #include "ui/wm/core/user_activity_observer.h" | 16 #include "ui/wm/core/user_activity_observer.h" |
| 18 | 17 |
| 19 namespace chromeos { | 18 namespace chromeos { |
| 20 | 19 |
| 21 class LoginDisplayWebUIHandler; | 20 class LoginDisplayWebUIHandler; |
| 22 | 21 |
| 23 // This class represents User Selection screen: user pod-based login screen. | 22 // This class represents User Selection screen: user pod-based login screen. |
| 24 class UserSelectionScreen : public wm::UserActivityObserver { | 23 class UserSelectionScreen : public wm::UserActivityObserver { |
| 25 public: | 24 public: |
| 26 UserSelectionScreen(); | 25 UserSelectionScreen(); |
| 27 virtual ~UserSelectionScreen(); | 26 virtual ~UserSelectionScreen(); |
| 28 | 27 |
| 29 static const user_manager::UserList PrepareUserListForSending( | 28 static const user_manager::UserList PrepareUserListForSending( |
| 30 const user_manager::UserList& users, | 29 const user_manager::UserList& users, |
| 31 std::string owner, | 30 std::string owner, |
| 32 bool is_signin_to_add); | 31 bool is_signin_to_add); |
| 33 | 32 |
| 34 void SetHandler(LoginDisplayWebUIHandler* handler); | 33 void SetHandler(LoginDisplayWebUIHandler* handler); |
| 35 | 34 |
| 36 void Init(const user_manager::UserList& users, bool show_guest); | 35 virtual void Init(const user_manager::UserList& users, bool show_guest); |
| 37 const user_manager::UserList& GetUsers() const; | 36 const user_manager::UserList& GetUsers() const; |
| 38 void OnUserImageChanged(const user_manager::User& user); | 37 void OnUserImageChanged(const user_manager::User& user); |
| 39 void OnBeforeUserRemoved(const std::string& username); | 38 void OnBeforeUserRemoved(const std::string& username); |
| 40 void OnUserRemoved(const std::string& username); | 39 void OnUserRemoved(const std::string& username); |
| 41 | 40 |
| 42 void OnPasswordClearTimerExpired(); | 41 void OnPasswordClearTimerExpired(); |
| 43 void SendUserList(); | 42 virtual void SendUserList(); |
| 44 void HandleGetUsers(); | 43 void HandleGetUsers(); |
| 45 void SetAuthType(const std::string& username, | 44 void SetAuthType(const std::string& username, |
| 46 ScreenlockBridge::LockHandler::AuthType auth_type); | 45 ScreenlockBridge::LockHandler::AuthType auth_type); |
| 47 ScreenlockBridge::LockHandler::AuthType GetAuthType( | 46 ScreenlockBridge::LockHandler::AuthType GetAuthType( |
| 48 const std::string& username) const; | 47 const std::string& username) const; |
| 49 | 48 |
| 50 // wm::UserActivityDetector implementation: | 49 // wm::UserActivityDetector implementation: |
| 51 virtual void OnUserActivity(const ui::Event* event) OVERRIDE; | 50 virtual void OnUserActivity(const ui::Event* event) OVERRIDE; |
| 52 | 51 |
| 53 // Fills |user_dict| with information about |user|. | 52 // Fills |user_dict| with information about |user|. |
| 54 static void FillUserDictionary( | 53 static void FillUserDictionary( |
| 55 user_manager::User* user, | 54 user_manager::User* user, |
| 56 bool is_owner, | 55 bool is_owner, |
| 57 bool is_signin_to_add, | 56 bool is_signin_to_add, |
| 58 ScreenlockBridge::LockHandler::AuthType auth_type, | 57 ScreenlockBridge::LockHandler::AuthType auth_type, |
| 59 base::DictionaryValue* user_dict); | 58 base::DictionaryValue* user_dict); |
| 60 | 59 |
| 61 // Determines if user auth status requires online sign in. | 60 // Determines if user auth status requires online sign in. |
| 62 static bool ShouldForceOnlineSignIn(const user_manager::User* user); | 61 static bool ShouldForceOnlineSignIn(const user_manager::User* user); |
| 63 | 62 |
| 64 private: | 63 protected: |
| 65 LoginDisplayWebUIHandler* handler_; | 64 LoginDisplayWebUIHandler* handler_; |
| 66 | 65 |
| 67 // Set of Users that are visible. | 66 // Set of Users that are visible. |
| 68 user_manager::UserList users_; | 67 user_manager::UserList users_; |
| 69 | 68 |
| 69 private: |
| 70 // Whether to show guest login. | 70 // Whether to show guest login. |
| 71 bool show_guest_; | 71 bool show_guest_; |
| 72 | 72 |
| 73 // Map of usernames to their current authentication type. If a user is not | 73 // Map of usernames to their current authentication type. If a user is not |
| 74 // contained in the map, it is using the default authentication type. | 74 // contained in the map, it is using the default authentication type. |
| 75 std::map<std::string, ScreenlockBridge::LockHandler::AuthType> | 75 std::map<std::string, ScreenlockBridge::LockHandler::AuthType> |
| 76 user_auth_type_map_; | 76 user_auth_type_map_; |
| 77 | 77 |
| 78 // Timer for measuring idle state duration before password clear. | 78 // Timer for measuring idle state duration before password clear. |
| 79 base::OneShotTimer<UserSelectionScreen> password_clear_timer_; | 79 base::OneShotTimer<UserSelectionScreen> password_clear_timer_; |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); | 81 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace chromeos | 84 } // namespace chromeos |
| 85 | 85 |
| 86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ | 86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ |
| OLD | NEW |