| 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 | 11 |
| 11 #include "base/bind.h" | 12 #include "base/bind.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 17 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 17 #include "chrome/browser/signin/screenlock_bridge.h" | 18 #include "chrome/browser/signin/screenlock_bridge.h" |
| 18 #include "components/user_manager/user.h" | 19 #include "components/user_manager/user.h" |
| 19 #include "ui/wm/core/user_activity_observer.h" | 20 #include "ui/wm/core/user_activity_observer.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // policy::DeviceLocalAccountPolicyService::Observer implementation: | 62 // policy::DeviceLocalAccountPolicyService::Observer implementation: |
| 62 virtual void OnPolicyUpdated(const std::string& user_id) OVERRIDE; | 63 virtual void OnPolicyUpdated(const std::string& user_id) OVERRIDE; |
| 63 virtual void OnDeviceLocalAccountsChanged() OVERRIDE; | 64 virtual void OnDeviceLocalAccountsChanged() OVERRIDE; |
| 64 | 65 |
| 65 // Fills |user_dict| with information about |user|. | 66 // Fills |user_dict| with information about |user|. |
| 66 static void FillUserDictionary( | 67 static void FillUserDictionary( |
| 67 user_manager::User* user, | 68 user_manager::User* user, |
| 68 bool is_owner, | 69 bool is_owner, |
| 69 bool is_signin_to_add, | 70 bool is_signin_to_add, |
| 70 ScreenlockBridge::LockHandler::AuthType auth_type, | 71 ScreenlockBridge::LockHandler::AuthType auth_type, |
| 72 const std::vector<std::string>* public_session_recommended_locales, |
| 71 base::DictionaryValue* user_dict); | 73 base::DictionaryValue* user_dict); |
| 72 | 74 |
| 73 // Determines if user auth status requires online sign in. | 75 // Determines if user auth status requires online sign in. |
| 74 static bool ShouldForceOnlineSignIn(const user_manager::User* user); | 76 static bool ShouldForceOnlineSignIn(const user_manager::User* user); |
| 75 | 77 |
| 76 private: | 78 private: |
| 77 // Check whether the display name set by policy for a public session has | 79 // Check whether the display name set by policy for a public session has |
| 78 // changed and if so, notify the UI. | 80 // changed and if so, notify the UI. |
| 79 void CheckForPublicSessionDisplayNameChange( | 81 void CheckForPublicSessionDisplayNameChange( |
| 80 policy::DeviceLocalAccountPolicyBroker* broker); | 82 policy::DeviceLocalAccountPolicyBroker* broker); |
| 81 | 83 |
| 82 // Notify the UI that the display name for a public session has changed, | 84 // Notify the UI that the display name for a public session has changed, |
| 83 // taking the display name from the |User| owned by |UserManager|. | 85 // taking the display name from the |User| owned by |UserManager|. |
| 84 void SetPublicSessionDisplayName(const std::string& user_id); | 86 void SetPublicSessionDisplayName(const std::string& user_id); |
| 85 | 87 |
| 88 // Check whether the list of recommended locales set by policy for a public |
| 89 // session has changed and if so, notify the UI. |
| 90 void CheckForPublicSessionLocalePolicyChange( |
| 91 policy::DeviceLocalAccountPolicyBroker* broker); |
| 92 |
| 93 // Send an updated list of locales for a public session to the UI, consisting |
| 94 // of the |recommended_locales| followed by all other available locales. |
| 95 void SetPublicSessionLocales( |
| 96 const std::string& user_id, |
| 97 const std::vector<std::string>* recommended_locales); |
| 98 |
| 86 LoginDisplayWebUIHandler* handler_; | 99 LoginDisplayWebUIHandler* handler_; |
| 87 bool handler_initialized_; | 100 bool handler_initialized_; |
| 88 | 101 |
| 89 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; | 102 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; |
| 90 | 103 |
| 91 // Set of Users that are visible. | 104 // Set of Users that are visible. |
| 92 user_manager::UserList users_; | 105 user_manager::UserList users_; |
| 93 | 106 |
| 94 // Whether to show guest login. | 107 // Whether to show guest login. |
| 95 bool show_guest_; | 108 bool show_guest_; |
| 96 | 109 |
| 97 // Map from public session user IDs to their display names set by policy. | 110 // Map from public session user IDs to their display names set by policy. |
| 98 typedef std::map<std::string, std::string> DisplayNamesMap; | 111 typedef std::map<std::string, std::string> DisplayNamesMap; |
| 99 DisplayNamesMap public_session_display_names_; | 112 DisplayNamesMap public_session_display_names_; |
| 100 | 113 |
| 114 // Map from public session user IDs to recommended locales set by policy. |
| 115 typedef std::map<std::string, std::vector<std::string> > |
| 116 PublicSessionRecommendedLocaleMap; |
| 117 PublicSessionRecommendedLocaleMap public_session_recommended_locales_; |
| 118 |
| 101 // Map of usernames to their current authentication type. If a user is not | 119 // Map of usernames to their current authentication type. If a user is not |
| 102 // contained in the map, it is using the default authentication type. | 120 // contained in the map, it is using the default authentication type. |
| 103 std::map<std::string, ScreenlockBridge::LockHandler::AuthType> | 121 std::map<std::string, ScreenlockBridge::LockHandler::AuthType> |
| 104 user_auth_type_map_; | 122 user_auth_type_map_; |
| 105 | 123 |
| 106 // Timer for measuring idle state duration before password clear. | 124 // Timer for measuring idle state duration before password clear. |
| 107 base::OneShotTimer<UserSelectionScreen> password_clear_timer_; | 125 base::OneShotTimer<UserSelectionScreen> password_clear_timer_; |
| 108 | 126 |
| 109 base::WeakPtrFactory<UserSelectionScreen> weak_factory_; | 127 base::WeakPtrFactory<UserSelectionScreen> weak_factory_; |
| 110 | 128 |
| 111 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); | 129 DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); |
| 112 }; | 130 }; |
| 113 | 131 |
| 114 } // namespace chromeos | 132 } // namespace chromeos |
| 115 | 133 |
| 116 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ | 134 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_SELECTION_SCREEN_H_ |
| OLD | NEW |