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

Side by Side Diff: components/user_manager/user_manager_base.h

Issue 2779973007: cros: Fix flaky owner detection (Closed)
Patch Set: rebase Created 3 years, 8 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 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 <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Should be called when regular user was removed. 244 // Should be called when regular user was removed.
245 virtual void OnUserRemoved(const AccountId& account_id) = 0; 245 virtual void OnUserRemoved(const AccountId& account_id) = 0;
246 246
247 // Update the global LoginState. 247 // Update the global LoginState.
248 virtual void UpdateLoginState(const User* active_user, 248 virtual void UpdateLoginState(const User* active_user,
249 const User* primary_user, 249 const User* primary_user,
250 bool is_current_user_owner) const = 0; 250 bool is_current_user_owner) const = 0;
251 251
252 // Getters/setters for private members. 252 // Getters/setters for private members.
253 253
254 virtual void SetCurrentUserIsOwner(bool is_current_user_owner);
255
256 virtual bool GetEphemeralUsersEnabled() const; 254 virtual bool GetEphemeralUsersEnabled() const;
257 virtual void SetEphemeralUsersEnabled(bool enabled); 255 virtual void SetEphemeralUsersEnabled(bool enabled);
258 256
259 virtual void SetOwnerId(const AccountId& owner_account_id); 257 virtual void SetOwnerId(const AccountId& owner_account_id);
260 258
261 virtual const AccountId& GetPendingUserSwitchID() const; 259 virtual const AccountId& GetPendingUserSwitchID() const;
262 virtual void SetPendingUserSwitchId(const AccountId& account_id); 260 virtual void SetPendingUserSwitchId(const AccountId& account_id);
263 261
264 // The logged-in user that is currently active in current session. 262 // The logged-in user that is currently active in current session.
265 // NULL until a user has logged in, then points to one 263 // NULL until a user has logged in, then points to one
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 virtual void UpdateUserAccountLocale(const AccountId& account_id, 336 virtual void UpdateUserAccountLocale(const AccountId& account_id,
339 const std::string& locale); 337 const std::string& locale);
340 338
341 // Updates user account after locale was resolved. 339 // Updates user account after locale was resolved.
342 void DoUpdateAccountLocale(const AccountId& account_id, 340 void DoUpdateAccountLocale(const AccountId& account_id,
343 std::unique_ptr<std::string> resolved_locale); 341 std::unique_ptr<std::string> resolved_locale);
344 342
345 // Indicates stage of loading user from prefs. 343 // Indicates stage of loading user from prefs.
346 UserLoadStage user_loading_stage_ = STAGE_NOT_LOADED; 344 UserLoadStage user_loading_stage_ = STAGE_NOT_LOADED;
347 345
348 // Cached flag of whether currently logged-in user is owner or not.
349 // May be accessed on different threads, requires locking.
350 bool is_current_user_owner_ = false;
351 mutable base::Lock is_current_user_owner_lock_;
xiyuan 2017/04/03 19:02:56 The comment and the lock is obsolete. Both IsCurr
352
353 // Cached flag of whether the currently logged-in user existed before this 346 // Cached flag of whether the currently logged-in user existed before this
354 // login. 347 // login.
355 bool is_current_user_new_ = false; 348 bool is_current_user_new_ = false;
356 349
357 // Cached flag of whether the currently logged-in user is a regular user who 350 // Cached flag of whether the currently logged-in user is a regular user who
358 // logged in as ephemeral. Storage of persistent information is avoided for 351 // logged in as ephemeral. Storage of persistent information is avoided for
359 // such users by not adding them to the persistent user list, not downloading 352 // such users by not adding them to the persistent user list, not downloading
360 // their custom avatars and mounting their cryptohomes using tmpfs. Defaults 353 // their custom avatars and mounting their cryptohomes using tmpfs. Defaults
361 // to |false|. 354 // to |false|.
362 bool is_current_user_ephemeral_regular_user_ = false; 355 bool is_current_user_ephemeral_regular_user_ = false;
(...skipping 30 matching lines...) Expand all
393 scoped_refptr<base::TaskRunner> task_runner_; 386 scoped_refptr<base::TaskRunner> task_runner_;
394 387
395 base::WeakPtrFactory<UserManagerBase> weak_factory_; 388 base::WeakPtrFactory<UserManagerBase> weak_factory_;
396 389
397 DISALLOW_COPY_AND_ASSIGN(UserManagerBase); 390 DISALLOW_COPY_AND_ASSIGN(UserManagerBase);
398 }; 391 };
399 392
400 } // namespace user_manager 393 } // namespace user_manager
401 394
402 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_ 395 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698