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_CHROME_USER_SELECTION_SCREEN_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_USER_SELECTION_SCREEN_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_USER_SELECTION_SCREEN_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_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/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" | 15 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 16 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
17 | 17 |
| 18 namespace user_manager { |
| 19 class UserID; |
| 20 } |
| 21 |
18 namespace chromeos { | 22 namespace chromeos { |
19 | 23 |
20 class ChromeUserSelectionScreen | 24 class ChromeUserSelectionScreen |
21 : public UserSelectionScreen, | 25 : public UserSelectionScreen, |
22 public policy::DeviceLocalAccountPolicyService::Observer { | 26 public policy::DeviceLocalAccountPolicyService::Observer { |
23 public: | 27 public: |
24 explicit ChromeUserSelectionScreen(const std::string& display_type); | 28 explicit ChromeUserSelectionScreen(const std::string& display_type); |
25 ~ChromeUserSelectionScreen() override; | 29 ~ChromeUserSelectionScreen() override; |
26 | 30 |
27 // UserSelectionScreen: | 31 // UserSelectionScreen: |
28 void Init(const user_manager::UserList& users, bool show_guest) override; | 32 void Init(const user_manager::UserList& users, bool show_guest) override; |
29 void SendUserList() override; | 33 void SendUserList() override; |
30 | 34 |
31 // policy::DeviceLocalAccountPolicyService::Observer: | 35 // policy::DeviceLocalAccountPolicyService::Observer: |
32 void OnPolicyUpdated(const std::string& user_id) override; | 36 void OnPolicyUpdated(const user_manager::UserID& user_id) override; |
33 void OnDeviceLocalAccountsChanged() override; | 37 void OnDeviceLocalAccountsChanged() override; |
34 | 38 |
35 private: | 39 private: |
36 // Check whether the display name set by policy for a public session has | 40 // Check whether the display name set by policy for a public session has |
37 // changed and if so, notify the UI. | 41 // changed and if so, notify the UI. |
38 void CheckForPublicSessionDisplayNameChange( | 42 void CheckForPublicSessionDisplayNameChange( |
39 policy::DeviceLocalAccountPolicyBroker* broker); | 43 policy::DeviceLocalAccountPolicyBroker* broker); |
40 | 44 |
41 // Check whether the list of recommended locales set by policy for a public | 45 // Check whether the list of recommended locales set by policy for a public |
42 // session has changed and if so, notify the UI. | 46 // session has changed and if so, notify the UI. |
43 void CheckForPublicSessionLocalePolicyChange( | 47 void CheckForPublicSessionLocalePolicyChange( |
44 policy::DeviceLocalAccountPolicyBroker* broker); | 48 policy::DeviceLocalAccountPolicyBroker* broker); |
45 | 49 |
46 // Notify the UI that the display name for a public session has changed, | 50 // Notify the UI that the display name for a public session has changed, |
47 // taking the display name from the |User| owned by |UserManager|. | 51 // taking the display name from the |User| owned by |UserManager|. |
48 void SetPublicSessionDisplayName(const std::string& user_id); | 52 void SetPublicSessionDisplayName(const user_manager::UserID& user_id); |
49 | 53 |
50 // Send an updated list of locales for a public session to the UI, consisting | 54 // 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. | 55 // of the |recommended_locales| followed by all other available locales. |
52 void SetPublicSessionLocales( | 56 void SetPublicSessionLocales( |
53 const std::string& user_id, | 57 const user_manager::UserID& user_id, |
54 const std::vector<std::string>& recommended_locales); | 58 const std::vector<std::string>& recommended_locales); |
55 | 59 |
56 bool handler_initialized_; | 60 bool handler_initialized_; |
57 | 61 |
58 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; | 62 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; |
59 | 63 |
60 // Map from public session user IDs to their display names set by policy. | 64 // Map from public session user IDs to their display names set by policy. |
61 typedef std::map<std::string, std::string> DisplayNamesMap; | 65 typedef std::map<user_manager::UserID, std::string> DisplayNamesMap; |
62 DisplayNamesMap public_session_display_names_; | 66 DisplayNamesMap public_session_display_names_; |
63 | 67 |
64 base::WeakPtrFactory<ChromeUserSelectionScreen> weak_factory_; | 68 base::WeakPtrFactory<ChromeUserSelectionScreen> weak_factory_; |
65 | 69 |
66 DISALLOW_COPY_AND_ASSIGN(ChromeUserSelectionScreen); | 70 DISALLOW_COPY_AND_ASSIGN(ChromeUserSelectionScreen); |
67 }; | 71 }; |
68 | 72 |
69 } // namespace chromeos | 73 } // namespace chromeos |
70 | 74 |
71 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_USER_SELECTION_SCREEN_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CHROME_USER_SELECTION_SCREEN_H_ |
OLD | NEW |