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

Side by Side Diff: chrome/browser/chromeos/login/screens/user_selection_screen.h

Issue 1454153002: Revert of This CL replaces e-mail with AccountId on user selection screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
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>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" 15 #include "chrome/browser/chromeos/login/signin/token_handle_util.h"
16 #include "chrome/browser/chromeos/login/ui/login_display.h" 16 #include "chrome/browser/chromeos/login/ui/login_display.h"
17 #include "chrome/browser/chromeos/login/ui/models/user_board_model.h" 17 #include "chrome/browser/chromeos/login/ui/models/user_board_model.h"
18 #include "components/proximity_auth/screenlock_bridge.h" 18 #include "components/proximity_auth/screenlock_bridge.h"
19 #include "components/signin/core/account_id/account_id.h"
20 #include "components/user_manager/user.h" 19 #include "components/user_manager/user.h"
21 #include "ui/base/user_activity/user_activity_observer.h" 20 #include "ui/base/user_activity/user_activity_observer.h"
22 21
23 class AccountId; 22 class AccountId;
24 class EasyUnlockService; 23 class EasyUnlockService;
25 24
26 namespace chromeos { 25 namespace chromeos {
27 26
28 class LoginDisplayWebUIHandler; 27 class LoginDisplayWebUIHandler;
29 class UserBoardView; 28 class UserBoardView;
30 29
31 // This class represents User Selection screen: user pod-based login screen. 30 // This class represents User Selection screen: user pod-based login screen.
32 class UserSelectionScreen 31 class UserSelectionScreen
33 : public ui::UserActivityObserver, 32 : public ui::UserActivityObserver,
34 public proximity_auth::ScreenlockBridge::LockHandler, 33 public proximity_auth::ScreenlockBridge::LockHandler,
35 public UserBoardModel { 34 public UserBoardModel {
36 public: 35 public:
37 explicit UserSelectionScreen(const std::string& display_type); 36 explicit UserSelectionScreen(const std::string& display_type);
38 ~UserSelectionScreen() override; 37 ~UserSelectionScreen() override;
39 38
40 void SetLoginDisplayDelegate(LoginDisplay::Delegate* login_display_delegate); 39 void SetLoginDisplayDelegate(LoginDisplay::Delegate* login_display_delegate);
41 void SetHandler(LoginDisplayWebUIHandler* handler); 40 void SetHandler(LoginDisplayWebUIHandler* handler);
42 void SetView(UserBoardView* view); 41 void SetView(UserBoardView* view);
43 42
44 static const user_manager::UserList PrepareUserListForSending( 43 static const user_manager::UserList PrepareUserListForSending(
45 const user_manager::UserList& users, 44 const user_manager::UserList& users,
46 const AccountId& owner, 45 std::string owner,
47 bool is_signin_to_add); 46 bool is_signin_to_add);
48 47
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 void OnUserImageChanged(const user_manager::User& user); 50 void OnUserImageChanged(const user_manager::User& user);
51 void OnBeforeUserRemoved(const std::string& username); 51 void OnBeforeUserRemoved(const std::string& username);
52 void OnUserRemoved(const std::string& username); 52 void OnUserRemoved(const std::string& username);
53 53
54 void OnPasswordClearTimerExpired(); 54 void OnPasswordClearTimerExpired();
55 55
56 void HandleGetUsers(); 56 void HandleGetUsers();
57 void CheckUserStatus(const AccountId& account_id); 57 void CheckUserStatus(const std::string& user_id);
58 58
59 // ui::UserActivityDetector implementation: 59 // ui::UserActivityDetector implementation:
60 void OnUserActivity(const ui::Event* event) override; 60 void OnUserActivity(const ui::Event* event) override;
61 61
62 void InitEasyUnlock(); 62 void InitEasyUnlock();
63 63
64 // proximity_auth::ScreenlockBridge::LockHandler implementation: 64 // proximity_auth::ScreenlockBridge::LockHandler implementation:
65 void ShowBannerMessage(const base::string16& message) override; 65 void ShowBannerMessage(const base::string16& message) override;
66 void ShowUserPodCustomIcon( 66 void ShowUserPodCustomIcon(
67 const std::string& user_email, 67 const std::string& user_email,
68 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon) 68 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon)
69 override; 69 override;
70 void HideUserPodCustomIcon(const std::string& user_email) override; 70 void HideUserPodCustomIcon(const std::string& user_email) override;
71 71
72 void EnableInput() override; 72 void EnableInput() override;
73 void SetAuthType(const std::string& user_email, 73 void SetAuthType(const std::string& user_email,
74 AuthType auth_type, 74 AuthType auth_type,
75 const base::string16& auth_value) override; 75 const base::string16& auth_value) override;
76 AuthType GetAuthType(const std::string& user_email) const override; 76 AuthType GetAuthType(const std::string& user_email) const override;
77 ScreenType GetScreenType() const override; 77 ScreenType GetScreenType() const override;
78 78
79 void Unlock(const std::string& user_email) override; 79 void Unlock(const std::string& user_email) override;
80 void AttemptEasySignin(const std::string& user_email, 80 void AttemptEasySignin(const std::string& user_email,
81 const std::string& secret, 81 const std::string& secret,
82 const std::string& key_label) override; 82 const std::string& key_label) override;
83 83
84 // UserBoardModel implementation. 84 // UserBoardModel implementation.
85 void SendUserList() override; 85 void SendUserList() override;
86 void HardLockPod(const AccountId& account_id) override; 86 void HardLockPod(const std::string& user_id) override;
87 void AttemptEasyUnlock(const AccountId& account_id) override; 87 void AttemptEasyUnlock(const std::string& user_id) override;
88 void RecordClickOnLockIcon(const AccountId& account_id) override; 88 void RecordClickOnLockIcon(const std::string& user_id) override;
89 89
90 // Fills |user_dict| with information about |user|. 90 // Fills |user_dict| with information about |user|.
91 static void FillUserDictionary( 91 static void FillUserDictionary(
92 user_manager::User* user, 92 user_manager::User* user,
93 bool is_owner, 93 bool is_owner,
94 bool is_signin_to_add, 94 bool is_signin_to_add,
95 AuthType auth_type, 95 AuthType auth_type,
96 const std::vector<std::string>* public_session_recommended_locales, 96 const std::vector<std::string>* public_session_recommended_locales,
97 base::DictionaryValue* user_dict); 97 base::DictionaryValue* user_dict);
98 98
99 // Fills |user_dict| with |user| known preferences. 99 // Fills |user_dict| with |user| known preferences.
100 static void FillKnownUserPrefs(user_manager::User* user, 100 static void FillKnownUserPrefs(user_manager::User* user,
101 base::DictionaryValue* user_dict); 101 base::DictionaryValue* user_dict);
102 102
103 // Fills |user_dict| with |user| multi-profile related preferences. 103 // Fills |user_dict| with |user| multi-profile related preferences.
104 static void FillMultiProfileUserPrefs(user_manager::User* user, 104 static void FillMultiProfileUserPrefs(user_manager::User* user,
105 base::DictionaryValue* user_dict, 105 base::DictionaryValue* user_dict,
106 bool is_signin_to_add); 106 bool is_signin_to_add);
107 107
108 // Determines if user auth status requires online sign in. 108 // Determines if user auth status requires online sign in.
109 static bool ShouldForceOnlineSignIn(const user_manager::User* user); 109 static bool ShouldForceOnlineSignIn(const user_manager::User* user);
110 110
111 protected: 111 protected:
112 // This call forms full account id of a known user by email.
113 // This is a temporary call while migrating to AccountId.
114 static AccountId GetAccountIdOfKnownUser(const std::string& user_id);
115
116 LoginDisplayWebUIHandler* handler_; 112 LoginDisplayWebUIHandler* handler_;
117 LoginDisplay::Delegate* login_display_delegate_; 113 LoginDisplay::Delegate* login_display_delegate_;
118 UserBoardView* view_; 114 UserBoardView* view_;
119 115
120 // Map from public session account IDs to recommended locales set by policy. 116 // Map from public session user IDs to recommended locales set by policy.
121 typedef std::map<AccountId, std::vector<std::string> > 117 typedef std::map<std::string, std::vector<std::string> >
122 PublicSessionRecommendedLocaleMap; 118 PublicSessionRecommendedLocaleMap;
123 PublicSessionRecommendedLocaleMap public_session_recommended_locales_; 119 PublicSessionRecommendedLocaleMap public_session_recommended_locales_;
124 120
125 private: 121 private:
126 EasyUnlockService* GetEasyUnlockServiceForUser( 122 EasyUnlockService* GetEasyUnlockServiceForUser(
127 const AccountId& account_id) const; 123 const std::string& user_id) const;
128 124
129 void OnUserStatusChecked(const AccountId& account_id, 125 void OnUserStatusChecked(const AccountId& account_id,
130 TokenHandleUtil::TokenHandleStatus status); 126 TokenHandleUtil::TokenHandleStatus status);
131 127
132 // Whether to show guest login. 128 // Whether to show guest login.
133 bool show_guest_; 129 bool show_guest_;
134 130
135 // Purpose of the screen (see constants in OobeUI). 131 // Purpose of the screen (see constants in OobeUI).
136 const std::string display_type_; 132 const std::string display_type_;
137 133
138 // Set of Users that are visible. 134 // Set of Users that are visible.
139 user_manager::UserList users_; 135 user_manager::UserList users_;
140 136
141 // Map of accounnt ids to their current authentication type. If a user is not 137 // Map of usernames to their current authentication type. If a user is not
142 // contained in the map, it is using the default authentication type. 138 // contained in the map, it is using the default authentication type.
143 std::map<AccountId, proximity_auth::ScreenlockBridge::LockHandler::AuthType> 139 std::map<std::string, proximity_auth::ScreenlockBridge::LockHandler::AuthType>
144 user_auth_type_map_; 140 user_auth_type_map_;
145 141
146 // Timer for measuring idle state duration before password clear. 142 // Timer for measuring idle state duration before password clear.
147 base::OneShotTimer password_clear_timer_; 143 base::OneShotTimer password_clear_timer_;
148 144
149 // Token handler util for checking user OAuth token status. 145 // Token handler util for checking user OAuth token status.
150 scoped_ptr<TokenHandleUtil> token_handle_util_; 146 scoped_ptr<TokenHandleUtil> token_handle_util_;
151 147
152 base::WeakPtrFactory<UserSelectionScreen> weak_factory_; 148 base::WeakPtrFactory<UserSelectionScreen> weak_factory_;
153 149
154 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); 150 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen);
155 }; 151 };
156 152
157 } // namespace chromeos 153 } // namespace chromeos
158 154
159 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ 155 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698