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

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

Issue 2568973002: chromeos: Replace user image notifications with observer (Closed)
Patch Set: rebase Created 4 years 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_H_ 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_H_
6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_ 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 21 matching lines...) Expand all
32 // * Find/modify users, store user meta-data such as display name/email. 32 // * Find/modify users, store user meta-data such as display name/email.
33 class USER_MANAGER_EXPORT UserManager { 33 class USER_MANAGER_EXPORT UserManager {
34 public: 34 public:
35 // Interface that observers of UserManager must implement in order 35 // Interface that observers of UserManager must implement in order
36 // to receive notification when local state preferences is changed 36 // to receive notification when local state preferences is changed
37 class Observer { 37 class Observer {
38 public: 38 public:
39 // Called when the local state preferences is changed. 39 // Called when the local state preferences is changed.
40 virtual void LocalStateChanged(UserManager* user_manager); 40 virtual void LocalStateChanged(UserManager* user_manager);
41 41
42 // Called when the image of the given user is changed.
43 virtual void OnUserImageChanged(const User& user);
44
45 // Called when the profile image download for the given user fails or
46 // user has the default profile image or no porfile image at all.
47 virtual void OnUserProfileImageUpdateFailed(const User& user);
48
49 // Called when the profile image for the given user is downloaded.
50 // |profile_image| contains the downloaded profile image.
51 virtual void OnUserProfileImageUpdated(const User& user,
52 const gfx::ImageSkia& profile_image);
53
42 protected: 54 protected:
43 virtual ~Observer(); 55 virtual ~Observer();
44 }; 56 };
45 57
46 // TODO(nkostylev): Refactor and move this observer out of UserManager. 58 // TODO(nkostylev): Refactor and move this observer out of UserManager.
47 // Observer interface that defines methods used to notify on user session / 59 // Observer interface that defines methods used to notify on user session /
48 // active user state changes. Default implementation is empty. 60 // active user state changes. Default implementation is empty.
49 class UserSessionStateObserver { 61 class UserSessionStateObserver {
50 public: 62 public:
51 // Called when active user has changed. 63 // Called when active user has changed.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 virtual bool IsUserCryptohomeDataEphemeral( 305 virtual bool IsUserCryptohomeDataEphemeral(
294 const AccountId& account_id) const = 0; 306 const AccountId& account_id) const = 0;
295 307
296 virtual void AddObserver(Observer* obs) = 0; 308 virtual void AddObserver(Observer* obs) = 0;
297 virtual void RemoveObserver(Observer* obs) = 0; 309 virtual void RemoveObserver(Observer* obs) = 0;
298 310
299 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0; 311 virtual void AddSessionStateObserver(UserSessionStateObserver* obs) = 0;
300 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0; 312 virtual void RemoveSessionStateObserver(UserSessionStateObserver* obs) = 0;
301 313
302 virtual void NotifyLocalStateChanged() = 0; 314 virtual void NotifyLocalStateChanged() = 0;
315 virtual void NotifyUserImageChanged(const User& user) = 0;
316 virtual void NotifyUserProfileImageUpdateFailed(const User& user) = 0;
317 virtual void NotifyUserProfileImageUpdated(
318 const User& user,
319 const gfx::ImageSkia& profile_image) = 0;
303 320
304 // Changes the child status and notifies observers. 321 // Changes the child status and notifies observers.
305 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; 322 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0;
306 323
307 324
308 // Returns true if supervised users allowed. 325 // Returns true if supervised users allowed.
309 virtual bool AreSupervisedUsersAllowed() const = 0; 326 virtual bool AreSupervisedUsersAllowed() const = 0;
310 327
311 // Returns "Local State" PrefService instance. 328 // Returns "Local State" PrefService instance.
312 virtual PrefService* GetLocalState() const = 0; 329 virtual PrefService* GetLocalState() const = 0;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 static UserManager* GetForTesting(); 391 static UserManager* GetForTesting();
375 392
376 // Sets UserManager instance to the given |user_manager|. 393 // Sets UserManager instance to the given |user_manager|.
377 // Returns the previous value of the instance. 394 // Returns the previous value of the instance.
378 static UserManager* SetForTesting(UserManager* user_manager); 395 static UserManager* SetForTesting(UserManager* user_manager);
379 }; 396 };
380 397
381 } // namespace user_manager 398 } // namespace user_manager
382 399
383 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ 400 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/profile_info_handler.cc ('k') | components/user_manager/user_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698