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_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/public/interfaces/login_user_info.mojom.h" | |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 | 14 |
14 class PrefChangeRegistrar; | 15 class PrefChangeRegistrar; |
15 class PrefRegistrySimple; | 16 class PrefRegistrySimple; |
16 class PrefService; | 17 class PrefService; |
17 class Profile; | 18 class Profile; |
18 | 19 |
19 namespace user_prefs { | 20 namespace user_prefs { |
20 class PrefRegistrySyncable; | 21 class PrefRegistrySyncable; |
21 } | 22 } |
22 | 23 |
24 using MultiProfileUserBehavior = ash::mojom::MultiProfileUserBehavior; | |
jdufault
2017/06/16 22:18:09
It doesn't look like this saves a lot of typing so
xiyuan
2017/06/16 23:05:41
+1
xiaoyinh(OOO Sep 11-29)
2017/06/19 17:29:50
Done.
| |
25 | |
23 namespace chromeos { | 26 namespace chromeos { |
24 | 27 |
25 class MultiProfileUserControllerDelegate; | 28 class MultiProfileUserControllerDelegate; |
26 | 29 |
27 // MultiProfileUserController decides whether a user is allowed to be in a | 30 // MultiProfileUserController decides whether a user is allowed to be in a |
28 // multi-profiles session. It caches the multi-profile user behavior pref backed | 31 // multi-profiles session. It caches the multi-profile user behavior pref backed |
29 // by user policy into local state so that the value is available before the | 32 // by user policy into local state so that the value is available before the |
30 // user login and checks if the meaning of the value is respected. | 33 // user login and checks if the meaning of the value is respected. |
31 class MultiProfileUserController { | 34 class MultiProfileUserController { |
32 public: | 35 public: |
(...skipping 15 matching lines...) Expand all Loading... | |
48 | 51 |
49 // Not allowed since primary user policy forbids it to be part of | 52 // Not allowed since primary user policy forbids it to be part of |
50 // multi-profiles session. | 53 // multi-profiles session. |
51 NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS, | 54 NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS, |
52 | 55 |
53 // Not allowed since user policy forbids this user being part of | 56 // Not allowed since user policy forbids this user being part of |
54 // multi-profiles session. Either 'primary-only' or 'not-allowed'. | 57 // multi-profiles session. Either 'primary-only' or 'not-allowed'. |
55 NOT_ALLOWED_POLICY_FORBIDS | 58 NOT_ALLOWED_POLICY_FORBIDS |
56 }; | 59 }; |
57 | 60 |
58 // Supported user behavior values. Keep in sync with the enum in | |
59 // md_user_pod_row.js and user_pod_row.js | |
60 enum class MultiProfileUserBehavior { | |
61 kUnrestriced, | |
62 kPrimaryOnly, | |
63 kNotAllowed, | |
64 kOwnerPrimaryOnly | |
65 }; | |
66 | |
67 MultiProfileUserController(MultiProfileUserControllerDelegate* delegate, | 61 MultiProfileUserController(MultiProfileUserControllerDelegate* delegate, |
68 PrefService* local_state); | 62 PrefService* local_state); |
69 ~MultiProfileUserController(); | 63 ~MultiProfileUserController(); |
70 | 64 |
71 static void RegisterPrefs(PrefRegistrySimple* registry); | 65 static void RegisterPrefs(PrefRegistrySimple* registry); |
72 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 66 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
73 | 67 |
74 // Returns the cached policy value for |user_email|. | 68 // Returns the cached policy value for |user_email|. |
75 std::string GetCachedValue(const std::string& user_email) const; | 69 std::string GetCachedValue(const std::string& user_email) const; |
76 | 70 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 MultiProfileUserControllerDelegate* delegate_; // Not owned. | 110 MultiProfileUserControllerDelegate* delegate_; // Not owned. |
117 PrefService* local_state_; // Not owned. | 111 PrefService* local_state_; // Not owned. |
118 std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_watchers_; | 112 std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_watchers_; |
119 | 113 |
120 DISALLOW_COPY_AND_ASSIGN(MultiProfileUserController); | 114 DISALLOW_COPY_AND_ASSIGN(MultiProfileUserController); |
121 }; | 115 }; |
122 | 116 |
123 } // namespace chromeos | 117 } // namespace chromeos |
124 | 118 |
125 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ | 119 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ |
OLD | NEW |