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 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... |
35 public: | 35 public: |
36 explicit UserSelectionScreen(const std::string& display_type); | 36 explicit UserSelectionScreen(const std::string& display_type); |
37 ~UserSelectionScreen() override; | 37 ~UserSelectionScreen() override; |
38 | 38 |
39 void SetLoginDisplayDelegate(LoginDisplay::Delegate* login_display_delegate); | 39 void SetLoginDisplayDelegate(LoginDisplay::Delegate* login_display_delegate); |
40 void SetHandler(LoginDisplayWebUIHandler* handler); | 40 void SetHandler(LoginDisplayWebUIHandler* handler); |
41 void SetView(UserBoardView* view); | 41 void SetView(UserBoardView* view); |
42 | 42 |
43 static const user_manager::UserList PrepareUserListForSending( | 43 static const user_manager::UserList PrepareUserListForSending( |
44 const user_manager::UserList& users, | 44 const user_manager::UserList& users, |
45 std::string owner, | 45 const user_manager::UserID& owner, |
46 bool is_signin_to_add); | 46 bool is_signin_to_add); |
47 | 47 |
48 | 48 |
49 virtual void Init(const user_manager::UserList& users, bool show_guest); | 49 virtual void Init(const user_manager::UserList& users, bool show_guest); |
50 const user_manager::UserList& GetUsers() const; | 50 const user_manager::UserList& GetUsers() const; |
51 void OnUserImageChanged(const user_manager::User& user); | 51 void OnUserImageChanged(const user_manager::User& user_id); |
52 void OnBeforeUserRemoved(const std::string& username); | 52 void OnBeforeUserRemoved(const user_manager::UserID& user_id); |
53 void OnUserRemoved(const std::string& username); | 53 void OnUserRemoved(const user_manager::UserID& user_id); |
54 | 54 |
55 void OnPasswordClearTimerExpired(); | 55 void OnPasswordClearTimerExpired(); |
56 | 56 |
57 void HandleGetUsers(); | 57 void HandleGetUsers(); |
58 void CheckUserStatus(const std::string& user_id); | 58 void CheckUserStatus(const user_manager::UserID& user_id); |
59 | 59 |
60 // ui::UserActivityDetector implementation: | 60 // ui::UserActivityDetector implementation: |
61 void OnUserActivity(const ui::Event* event) override; | 61 void OnUserActivity(const ui::Event* event) override; |
62 | 62 |
63 void InitEasyUnlock(); | 63 void InitEasyUnlock(); |
64 | 64 |
65 // proximity_auth::ScreenlockBridge::LockHandler implementation: | 65 // proximity_auth::ScreenlockBridge::LockHandler implementation: |
66 void ShowBannerMessage(const base::string16& message) override; | 66 void ShowBannerMessage(const base::string16& message) override; |
67 void ShowUserPodCustomIcon( | 67 void ShowUserPodCustomIcon( |
68 const std::string& user_email, | 68 const user_manager::UserID& user_id, |
69 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon) | 69 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon) |
70 override; | 70 override; |
71 void HideUserPodCustomIcon(const std::string& user_email) override; | 71 void HideUserPodCustomIcon(const user_manager::UserID& user_id) override; |
72 | 72 |
73 void EnableInput() override; | 73 void EnableInput() override; |
74 void SetAuthType(const std::string& user_email, | 74 void SetAuthType(const user_manager::UserID& user_id, |
75 AuthType auth_type, | 75 AuthType auth_type, |
76 const base::string16& auth_value) override; | 76 const base::string16& auth_value) override; |
77 AuthType GetAuthType(const std::string& user_email) const override; | 77 AuthType GetAuthType(const user_manager::UserID& user_id) const override; |
78 ScreenType GetScreenType() const override; | 78 ScreenType GetScreenType() const override; |
79 | 79 |
80 void Unlock(const std::string& user_email) override; | 80 void Unlock(const user_manager::UserID& user_id) override; |
81 void AttemptEasySignin(const std::string& user_email, | 81 void AttemptEasySignin(const user_manager::UserID& user_id, |
82 const std::string& secret, | 82 const std::string& secret, |
83 const std::string& key_label) override; | 83 const std::string& key_label) override; |
84 | 84 |
85 // UserBoardModel implementation. | 85 // UserBoardModel implementation. |
86 void SendUserList() override; | 86 void SendUserList() override; |
87 void HardLockPod(const std::string& user_id) override; | 87 void HardLockPod(const user_manager::UserID& user_id) override; |
88 void AttemptEasyUnlock(const std::string& user_id) override; | 88 void AttemptEasyUnlock(const user_manager::UserID& user_id) override; |
89 void RecordClickOnLockIcon(const std::string& user_id) override; | 89 void RecordClickOnLockIcon(const user_manager::UserID& user_id) override; |
90 | 90 |
91 // Fills |user_dict| with information about |user|. | 91 // Fills |user_dict| with information about |user|. |
92 static void FillUserDictionary( | 92 static void FillUserDictionary( |
93 user_manager::User* user, | 93 user_manager::User* user, |
94 bool is_owner, | 94 bool is_owner, |
95 bool is_signin_to_add, | 95 bool is_signin_to_add, |
96 AuthType auth_type, | 96 AuthType auth_type, |
97 const std::vector<std::string>* public_session_recommended_locales, | 97 const std::vector<std::string>* public_session_recommended_locales, |
98 base::DictionaryValue* user_dict); | 98 base::DictionaryValue* user_dict); |
99 | 99 |
100 // Fills |user_dict| with |user| known preferences. | 100 // Fills |user_dict| with |user| known preferences. |
101 static void FillKnownUserPrefs(user_manager::User* user, | 101 static void FillKnownUserPrefs(user_manager::User* user, |
102 base::DictionaryValue* user_dict); | 102 base::DictionaryValue* user_dict); |
103 | 103 |
104 // Fills |user_dict| with |user| multi-profile related preferences. | 104 // Fills |user_dict| with |user| multi-profile related preferences. |
105 static void FillMultiProfileUserPrefs(user_manager::User* user, | 105 static void FillMultiProfileUserPrefs(user_manager::User* user, |
106 base::DictionaryValue* user_dict, | 106 base::DictionaryValue* user_dict, |
107 bool is_signin_to_add); | 107 bool is_signin_to_add); |
108 | 108 |
109 // Determines if user auth status requires online sign in. | 109 // Determines if user auth status requires online sign in. |
110 static bool ShouldForceOnlineSignIn(const user_manager::User* user); | 110 static bool ShouldForceOnlineSignIn(const user_manager::User* user); |
111 | 111 |
112 protected: | 112 protected: |
113 LoginDisplayWebUIHandler* handler_; | 113 LoginDisplayWebUIHandler* handler_; |
114 LoginDisplay::Delegate* login_display_delegate_; | 114 LoginDisplay::Delegate* login_display_delegate_; |
115 UserBoardView* view_; | 115 UserBoardView* view_; |
116 | 116 |
117 // Map from public session user IDs to recommended locales set by policy. | 117 // Map from public session user IDs to recommended locales set by policy. |
118 typedef std::map<std::string, std::vector<std::string> > | 118 typedef std::map<user_manager::UserID, std::vector<std::string> > |
119 PublicSessionRecommendedLocaleMap; | 119 PublicSessionRecommendedLocaleMap; |
120 PublicSessionRecommendedLocaleMap public_session_recommended_locales_; | 120 PublicSessionRecommendedLocaleMap public_session_recommended_locales_; |
121 | 121 |
122 private: | 122 private: |
123 EasyUnlockService* GetEasyUnlockServiceForUser( | 123 EasyUnlockService* GetEasyUnlockServiceForUser( |
124 const std::string& user_id) const; | 124 const user_manager::UserID& user_id) const; |
125 | 125 |
126 void OnUserStatusChecked(const user_manager::UserID& user_id, | 126 void OnUserStatusChecked(const user_manager::UserID& user_id, |
127 TokenHandleUtil::TokenHandleStatus status); | 127 TokenHandleUtil::TokenHandleStatus status); |
128 | 128 |
129 // Whether to show guest login. | 129 // Whether to show guest login. |
130 bool show_guest_; | 130 bool show_guest_; |
131 | 131 |
132 // Purpose of the screen (see constants in OobeUI). | 132 // Purpose of the screen (see constants in OobeUI). |
133 const std::string display_type_; | 133 const std::string display_type_; |
134 | 134 |
135 // Set of Users that are visible. | 135 // Set of Users that are visible. |
136 user_manager::UserList users_; | 136 user_manager::UserList users_; |
137 | 137 |
138 // Map of usernames to their current authentication type. If a user is not | 138 // Map of usernames to their current authentication type. If a user is not |
139 // contained in the map, it is using the default authentication type. | 139 // contained in the map, it is using the default authentication type. |
140 std::map<std::string, proximity_auth::ScreenlockBridge::LockHandler::AuthType> | 140 std::map<user_manager::UserID, proximity_auth::ScreenlockBridge::LockHandler::
AuthType> |
141 user_auth_type_map_; | 141 user_auth_type_map_; |
142 | 142 |
143 // Timer for measuring idle state duration before password clear. | 143 // Timer for measuring idle state duration before password clear. |
144 base::OneShotTimer<UserSelectionScreen> password_clear_timer_; | 144 base::OneShotTimer<UserSelectionScreen> password_clear_timer_; |
145 | 145 |
146 // Token handler util for checking user OAuth token status. | 146 // Token handler util for checking user OAuth token status. |
147 scoped_ptr<TokenHandleUtil> token_handle_util_; | 147 scoped_ptr<TokenHandleUtil> token_handle_util_; |
148 | 148 |
149 base::WeakPtrFactory<UserSelectionScreen> weak_factory_; | 149 base::WeakPtrFactory<UserSelectionScreen> weak_factory_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); | 151 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace chromeos | 154 } // namespace chromeos |
155 | 155 |
156 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ | 156 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ |
OLD | NEW |