Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/chromeos/login/users/multi_profile_user_controller.h

Issue 2946463002: Convert multi-profile user behavior string to enum and send it to UI. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Not allowed since primary user policy forbids it to be part of 49 // Not allowed since primary user policy forbids it to be part of
50 // multi-profiles session. 50 // multi-profiles session.
51 NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS, 51 NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS,
52 52
53 // Not allowed since user policy forbids this user being part of 53 // Not allowed since user policy forbids this user being part of
54 // multi-profiles session. Either 'primary-only' or 'not-allowed'. 54 // multi-profiles session. Either 'primary-only' or 'not-allowed'.
55 NOT_ALLOWED_POLICY_FORBIDS 55 NOT_ALLOWED_POLICY_FORBIDS
56 }; 56 };
57 57
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
58 MultiProfileUserController(MultiProfileUserControllerDelegate* delegate, 67 MultiProfileUserController(MultiProfileUserControllerDelegate* delegate,
59 PrefService* local_state); 68 PrefService* local_state);
60 ~MultiProfileUserController(); 69 ~MultiProfileUserController();
61 70
62 static void RegisterPrefs(PrefRegistrySimple* registry); 71 static void RegisterPrefs(PrefRegistrySimple* registry);
63 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 72 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
64 73
65 // Returns the cached policy value for |user_email|. 74 // Returns the cached policy value for |user_email|.
66 std::string GetCachedValue(const std::string& user_email) const; 75 std::string GetCachedValue(const std::string& user_email) const;
67 76
68 // Returns primary user policy (only ALLOW, 77 // Returns primary user policy (only ALLOW,
69 // NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED, 78 // NOT_ALLOWED_PRIMARY_POLICY_CERT_TAINTED,
70 // NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS) 79 // NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS)
71 static UserAllowedInSessionReason GetPrimaryUserPolicy(); 80 static UserAllowedInSessionReason GetPrimaryUserPolicy();
72 81
82 // Returns the user behavior in MultiProfileUserBehavior enum.
83 static MultiProfileUserBehavior UserBehaviorStringToEnum(
84 const std::string& behavior);
85
73 // Returns true if user allowed to be in the current session. If |reason| not 86 // Returns true if user allowed to be in the current session. If |reason| not
74 // null stores UserAllowedInSessionReason enum that describes actual reason. 87 // null stores UserAllowedInSessionReason enum that describes actual reason.
75 bool IsUserAllowedInSession(const std::string& user_email, 88 bool IsUserAllowedInSession(const std::string& user_email,
76 UserAllowedInSessionReason* reason) const; 89 UserAllowedInSessionReason* reason) const;
77 90
78 // Starts to observe the multiprofile user behavior pref of the given profile. 91 // Starts to observe the multiprofile user behavior pref of the given profile.
79 void StartObserving(Profile* user_profile); 92 void StartObserving(Profile* user_profile);
80 93
81 // Removes the cached values for the given user. 94 // Removes the cached values for the given user.
82 void RemoveCachedValues(const std::string& user_email); 95 void RemoveCachedValues(const std::string& user_email);
(...skipping 20 matching lines...) Expand all
103 MultiProfileUserControllerDelegate* delegate_; // Not owned. 116 MultiProfileUserControllerDelegate* delegate_; // Not owned.
104 PrefService* local_state_; // Not owned. 117 PrefService* local_state_; // Not owned.
105 std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_watchers_; 118 std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_watchers_;
106 119
107 DISALLOW_COPY_AND_ASSIGN(MultiProfileUserController); 120 DISALLOW_COPY_AND_ASSIGN(MultiProfileUserController);
108 }; 121 };
109 122
110 } // namespace chromeos 123 } // namespace chromeos
111 124
112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_ 125 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_MULTI_PROFILE_USER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698