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 COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 bool IsUserNonCryptohomeDataEphemeral( | 99 bool IsUserNonCryptohomeDataEphemeral( |
100 const AccountId& account_id) const override; | 100 const AccountId& account_id) const override; |
101 void AddObserver(UserManager::Observer* obs) override; | 101 void AddObserver(UserManager::Observer* obs) override; |
102 void RemoveObserver(UserManager::Observer* obs) override; | 102 void RemoveObserver(UserManager::Observer* obs) override; |
103 void AddSessionStateObserver( | 103 void AddSessionStateObserver( |
104 UserManager::UserSessionStateObserver* obs) override; | 104 UserManager::UserSessionStateObserver* obs) override; |
105 void RemoveSessionStateObserver( | 105 void RemoveSessionStateObserver( |
106 UserManager::UserSessionStateObserver* obs) override; | 106 UserManager::UserSessionStateObserver* obs) override; |
107 void NotifyLocalStateChanged() override; | 107 void NotifyLocalStateChanged() override; |
108 void ChangeUserChildStatus(User* user, bool is_child) override; | 108 void ChangeUserChildStatus(User* user, bool is_child) override; |
109 bool FindKnownUserPrefs(const AccountId& account_id, | |
110 const base::DictionaryValue** out_value) override; | |
111 void UpdateKnownUserPrefs(const AccountId& account_id, | |
112 const base::DictionaryValue& values, | |
113 bool clear) override; | |
114 bool GetKnownUserStringPref(const AccountId& account_id, | |
115 const std::string& path, | |
116 std::string* out_value) override; | |
117 void SetKnownUserStringPref(const AccountId& account_id, | |
118 const std::string& path, | |
119 const std::string& in_value) override; | |
120 bool GetKnownUserBooleanPref(const AccountId& account_id, | |
121 const std::string& path, | |
122 bool* out_value) override; | |
123 void SetKnownUserBooleanPref(const AccountId& account_id, | |
124 const std::string& path, | |
125 const bool in_value) override; | |
126 bool GetKnownUserIntegerPref(const AccountId& account_id, | |
127 const std::string& path, | |
128 int* out_value) override; | |
129 void SetKnownUserIntegerPref(const AccountId& account_id, | |
130 const std::string& path, | |
131 int in_value) override; | |
132 AccountId GetKnownUserAccountIdImpl(const std::string& user_email, | |
133 const std::string& gaia_id) override; | |
134 void UpdateGaiaID(const AccountId& account_id, | |
135 const std::string& gaia_id) override; | |
136 bool FindGaiaID(const AccountId& account_id, std::string* out_value) override; | |
137 void UpdateUsingSAML(const AccountId& account_id, | |
138 const bool using_saml) override; | |
139 bool FindUsingSAML(const AccountId& account_id) override; | |
140 void SetKnownUserDeviceId(const AccountId& account_id, | |
141 const std::string& device_id) override; | |
142 std::string GetKnownUserDeviceId(const AccountId& account_id) override; | |
143 void SetKnownUserGAPSCookie(const AccountId& account_id, | |
144 const std::string& gaps_cookie) override; | |
145 std::string GetKnownUserGAPSCookie(const AccountId& account_id) override; | |
146 void UpdateReauthReason(const AccountId& account_id, | |
147 int reauth_reason) override; | |
148 bool FindReauthReason(const AccountId& account_id, int* out_value) override; | |
149 | 109 |
150 // This method updates "User was added to the device in this session nad is | 110 // This method updates "User was added to the device in this session nad is |
151 // not full initialized yet" flag. | 111 // not full initialized yet" flag. |
152 virtual void SetIsCurrentUserNew(bool is_new); | 112 virtual void SetIsCurrentUserNew(bool is_new); |
153 | 113 |
154 // TODO(xiyuan): Figure out a better way to expose this info. | 114 // TODO(xiyuan): Figure out a better way to expose this info. |
155 virtual bool HasPendingBootstrap(const AccountId& account_id) const; | 115 virtual bool HasPendingBootstrap(const AccountId& account_id) const; |
156 | 116 |
157 // Helper function that converts users from |users_list| to |users_vector| and | 117 // Helper function that converts users from |users_list| to |users_vector| and |
158 // |users_set|. Duplicates and users already present in |existing_users| are | 118 // |users_set|. Duplicates and users already present in |existing_users| are |
(...skipping 15 matching lines...) Expand all Loading... |
174 // Returns true if user may be removed. | 134 // Returns true if user may be removed. |
175 virtual bool CanUserBeRemoved(const User* user) const; | 135 virtual bool CanUserBeRemoved(const User* user) const; |
176 | 136 |
177 // A wrapper around C++ delete operator. Deletes |user|, and when |user| | 137 // A wrapper around C++ delete operator. Deletes |user|, and when |user| |
178 // equals to active_user_, active_user_ is reset to NULL. | 138 // equals to active_user_, active_user_ is reset to NULL. |
179 virtual void DeleteUser(User* user); | 139 virtual void DeleteUser(User* user); |
180 | 140 |
181 // Returns the locale used by the application. | 141 // Returns the locale used by the application. |
182 virtual const std::string& GetApplicationLocale() const = 0; | 142 virtual const std::string& GetApplicationLocale() const = 0; |
183 | 143 |
184 // Returns "Local State" PrefService instance. | |
185 virtual PrefService* GetLocalState() const = 0; | |
186 | |
187 // Loads |users_| from Local State if the list has not been loaded yet. | 144 // Loads |users_| from Local State if the list has not been loaded yet. |
188 // Subsequent calls have no effect. Must be called on the UI thread. | 145 // Subsequent calls have no effect. Must be called on the UI thread. |
189 virtual void EnsureUsersLoaded(); | 146 virtual void EnsureUsersLoaded(); |
190 | 147 |
191 // Handle OAuth token |status| change for |account_id|. | 148 // Handle OAuth token |status| change for |account_id|. |
192 virtual void HandleUserOAuthTokenStatusChange( | 149 virtual void HandleUserOAuthTokenStatusChange( |
193 const AccountId& account_id, | 150 const AccountId& account_id, |
194 User::OAuthTokenStatus status) const = 0; | 151 User::OAuthTokenStatus status) const = 0; |
195 | 152 |
196 // Returns true if device is enterprise managed. | 153 // Returns true if device is enterprise managed. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 void SendGaiaUserLoginMetrics(const AccountId& account_id); | 322 void SendGaiaUserLoginMetrics(const AccountId& account_id); |
366 | 323 |
367 // Sets account locale for user with id |account_id|. | 324 // Sets account locale for user with id |account_id|. |
368 virtual void UpdateUserAccountLocale(const AccountId& account_id, | 325 virtual void UpdateUserAccountLocale(const AccountId& account_id, |
369 const std::string& locale); | 326 const std::string& locale); |
370 | 327 |
371 // Updates user account after locale was resolved. | 328 // Updates user account after locale was resolved. |
372 void DoUpdateAccountLocale(const AccountId& account_id, | 329 void DoUpdateAccountLocale(const AccountId& account_id, |
373 scoped_ptr<std::string> resolved_locale); | 330 scoped_ptr<std::string> resolved_locale); |
374 | 331 |
375 // Removes all user preferences associated with |account_id|. | |
376 void RemoveKnownUserPrefs(const AccountId& account_id); | |
377 | |
378 // Indicates stage of loading user from prefs. | 332 // Indicates stage of loading user from prefs. |
379 UserLoadStage user_loading_stage_ = STAGE_NOT_LOADED; | 333 UserLoadStage user_loading_stage_ = STAGE_NOT_LOADED; |
380 | 334 |
381 // True if SessionStarted() has been called. | 335 // True if SessionStarted() has been called. |
382 bool session_started_ = false; | 336 bool session_started_ = false; |
383 | 337 |
384 // Cached flag of whether currently logged-in user is owner or not. | 338 // Cached flag of whether currently logged-in user is owner or not. |
385 // May be accessed on different threads, requires locking. | 339 // May be accessed on different threads, requires locking. |
386 bool is_current_user_owner_ = false; | 340 bool is_current_user_owner_ = false; |
387 mutable base::Lock is_current_user_owner_lock_; | 341 mutable base::Lock is_current_user_owner_lock_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 386 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
433 | 387 |
434 base::WeakPtrFactory<UserManagerBase> weak_factory_; | 388 base::WeakPtrFactory<UserManagerBase> weak_factory_; |
435 | 389 |
436 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); | 390 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); |
437 }; | 391 }; |
438 | 392 |
439 } // namespace user_manager | 393 } // namespace user_manager |
440 | 394 |
441 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ | 395 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ |
OLD | NEW |