Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / login / screens / chrome_user_selection_screen.h
blobe276911a1136baadd97a1ee5c4691b46335728b8
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_USER_SELECTION_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_USER_SELECTION_SCREEN_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/compiler_specific.h"
13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h"
16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
18 namespace chromeos {
20 class ChromeUserSelectionScreen
21 : public UserSelectionScreen,
22 public policy::DeviceLocalAccountPolicyService::Observer {
23 public:
24 explicit ChromeUserSelectionScreen(const std::string& display_type);
25 ~ChromeUserSelectionScreen() override;
27 // UserSelectionScreen:
28 void Init(const user_manager::UserList& users, bool show_guest) override;
29 void SendUserList() override;
31 // policy::DeviceLocalAccountPolicyService::Observer:
32 void OnPolicyUpdated(const std::string& user_id) override;
33 void OnDeviceLocalAccountsChanged() override;
35 private:
36 // Check whether the display name set by policy for a public session has
37 // changed and if so, notify the UI.
38 void CheckForPublicSessionDisplayNameChange(
39 policy::DeviceLocalAccountPolicyBroker* broker);
41 // Check whether the list of recommended locales set by policy for a public
42 // session has changed and if so, notify the UI.
43 void CheckForPublicSessionLocalePolicyChange(
44 policy::DeviceLocalAccountPolicyBroker* broker);
46 // Notify the UI that the display name for a public session has changed,
47 // taking the display name from the |User| owned by |UserManager|.
48 void SetPublicSessionDisplayName(const std::string& user_id);
50 // Send an updated list of locales for a public session to the UI, consisting
51 // of the |recommended_locales| followed by all other available locales.
52 void SetPublicSessionLocales(
53 const std::string& user_id,
54 const std::vector<std::string>& recommended_locales);
56 bool handler_initialized_;
58 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_;
60 // Map from public session user IDs to their display names set by policy.
61 typedef std::map<std::string, std::string> DisplayNamesMap;
62 DisplayNamesMap public_session_display_names_;
64 base::WeakPtrFactory<ChromeUserSelectionScreen> weak_factory_;
66 DISALLOW_COPY_AND_ASSIGN(ChromeUserSelectionScreen);
69 } // namespace chromeos
71 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_USER_SELECTION_SCREEN_H_