Chromium Code Reviews| Index: chrome/browser/chromeos/login/screens/user_selection_screen.h |
| diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.h b/chrome/browser/chromeos/login/screens/user_selection_screen.h |
| index 36ddcf725274be42fd01fd077eb0a30a6d571b58..b7832f9dbcb2792eafb84c5b63ab9ee730c3eafc 100644 |
| --- a/chrome/browser/chromeos/login/screens/user_selection_screen.h |
| +++ b/chrome/browser/chromeos/login/screens/user_selection_screen.h |
| @@ -10,18 +10,26 @@ |
| #include "base/bind.h" |
| #include "base/compiler_specific.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/timer/timer.h" |
| #include "base/values.h" |
| +#include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
|
Nikita (slow)
2014/07/30 09:27:58
Would it be possible to encapsulate chrome/browser
bartfab (slow)
2014/08/04 13:46:49
I moved all policy-related code to a ChromeUserSel
|
| #include "chrome/browser/signin/screenlock_bridge.h" |
| #include "components/user_manager/user.h" |
| #include "ui/wm/core/user_activity_observer.h" |
| +namespace policy { |
| +class DeviceLocalAccountPolicyBroker; |
| +} |
| + |
| namespace chromeos { |
| class LoginDisplayWebUIHandler; |
| // This class represents User Selection screen: user pod-based login screen. |
| -class UserSelectionScreen : public wm::UserActivityObserver { |
| +class UserSelectionScreen |
| + : public wm::UserActivityObserver, |
| + public policy::DeviceLocalAccountPolicyService::Observer { |
| public: |
| UserSelectionScreen(); |
| virtual ~UserSelectionScreen(); |
| @@ -50,6 +58,10 @@ class UserSelectionScreen : public wm::UserActivityObserver { |
| // wm::UserActivityDetector implementation: |
| virtual void OnUserActivity(const ui::Event* event) OVERRIDE; |
| + // policy::DeviceLocalAccountPolicyService::Observer implementation: |
| + virtual void OnPolicyUpdated(const std::string& user_id) OVERRIDE; |
| + virtual void OnDeviceLocalAccountsChanged() OVERRIDE; |
| + |
| // Fills |user_dict| with information about |user|. |
| static void FillUserDictionary( |
| user_manager::User* user, |
| @@ -62,7 +74,19 @@ class UserSelectionScreen : public wm::UserActivityObserver { |
| static bool ShouldForceOnlineSignIn(const user_manager::User* user); |
| private: |
| + // Check whether the display name set by policy for a public session has |
| + // changed and if so, notify the UI. |
| + void CheckForPublicSessionDisplayNameChange( |
| + policy::DeviceLocalAccountPolicyBroker* broker); |
| + |
| + // Notify the UI that the display name for a public session has changed, |
| + // taking the display name from the |User| owned by |UserManager|. |
| + void SetPublicSessionDisplayName(const std::string& user_id); |
| + |
| LoginDisplayWebUIHandler* handler_; |
| + bool handler_initialized_; |
| + |
| + policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; |
| // Set of Users that are visible. |
| user_manager::UserList users_; |
| @@ -70,6 +94,10 @@ class UserSelectionScreen : public wm::UserActivityObserver { |
| // Whether to show guest login. |
| bool show_guest_; |
| + // Map from public session user IDs to their display names set by policy. |
| + typedef std::map<std::string, std::string> DisplayNamesMap; |
| + DisplayNamesMap public_session_display_names_; |
| + |
| // Map of usernames to their current authentication type. If a user is not |
| // contained in the map, it is using the default authentication type. |
| std::map<std::string, ScreenlockBridge::LockHandler::AuthType> |
| @@ -78,6 +106,8 @@ class UserSelectionScreen : public wm::UserActivityObserver { |
| // Timer for measuring idle state duration before password clear. |
| base::OneShotTimer<UserSelectionScreen> password_clear_timer_; |
| + base::WeakPtrFactory<UserSelectionScreen> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(UserSelectionScreen); |
| }; |