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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.h

Issue 10832035: Switch from SignedSettings to DeviceSettingsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More test fixing... Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_USER_MANAGER_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "base/timer.h" 18 #include "base/timer.h"
19 #include "chrome/browser/chromeos/login/device_settings_service.h"
19 #include "chrome/browser/chromeos/login/user.h" 20 #include "chrome/browser/chromeos/login/user.h"
20 #include "chrome/browser/chromeos/login/user_image_loader.h" 21 #include "chrome/browser/chromeos/login/user_image_loader.h"
21 #include "chrome/browser/chromeos/login/user_manager.h" 22 #include "chrome/browser/chromeos/login/user_manager.h"
22 #include "chrome/browser/chromeos/login/wallpaper_manager.h" 23 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
23 #include "chrome/browser/profiles/profile_downloader_delegate.h" 24 #include "chrome/browser/profiles/profile_downloader_delegate.h"
24 #include "chrome/browser/sync/profile_sync_service_observer.h" 25 #include "chrome/browser/sync/profile_sync_service_observer.h"
25 #include "content/public/browser/notification_observer.h" 26 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 27 #include "content/public/browser/notification_registrar.h"
27 28
28 class SkBitmap;
29 class FilePath; 29 class FilePath;
30 class PrefService; 30 class PrefService;
31 class ProfileDownloader; 31 class ProfileDownloader;
32 class ProfileSyncService; 32 class ProfileSyncService;
33 class SkBitmap;
33 34
34 namespace chromeos { 35 namespace chromeos {
35 36
36 class RemoveUserDelegate; 37 class RemoveUserDelegate;
37 class UserImage; 38 class UserImage;
38 39
39 // Implementation of the UserManager. 40 // Implementation of the UserManager.
40 class UserManagerImpl : public UserManager, 41 class UserManagerImpl : public UserManager,
41 public ProfileDownloaderDelegate, 42 public ProfileDownloaderDelegate,
42 public ProfileSyncServiceObserver, 43 public ProfileSyncServiceObserver,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const std::string& username) OVERRIDE; 95 const std::string& username) OVERRIDE;
95 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE; 96 virtual void DownloadProfileImage(const std::string& reason) OVERRIDE;
96 virtual bool IsCurrentUserOwner() const OVERRIDE; 97 virtual bool IsCurrentUserOwner() const OVERRIDE;
97 virtual bool IsCurrentUserNew() const OVERRIDE; 98 virtual bool IsCurrentUserNew() const OVERRIDE;
98 virtual bool IsCurrentUserEphemeral() const OVERRIDE; 99 virtual bool IsCurrentUserEphemeral() const OVERRIDE;
99 virtual bool IsUserLoggedIn() const OVERRIDE; 100 virtual bool IsUserLoggedIn() const OVERRIDE;
100 virtual bool IsLoggedInAsDemoUser() const OVERRIDE; 101 virtual bool IsLoggedInAsDemoUser() const OVERRIDE;
101 virtual bool IsLoggedInAsGuest() const OVERRIDE; 102 virtual bool IsLoggedInAsGuest() const OVERRIDE;
102 virtual bool IsLoggedInAsStub() const OVERRIDE; 103 virtual bool IsLoggedInAsStub() const OVERRIDE;
103 virtual bool IsSessionStarted() const OVERRIDE; 104 virtual bool IsSessionStarted() const OVERRIDE;
104 virtual void AddObserver(Observer* obs) OVERRIDE; 105 virtual void AddObserver(UserManager::Observer* obs) OVERRIDE;
105 virtual void RemoveObserver(Observer* obs) OVERRIDE; 106 virtual void RemoveObserver(UserManager::Observer* obs) OVERRIDE;
106 virtual void NotifyLocalStateChanged() OVERRIDE; 107 virtual void NotifyLocalStateChanged() OVERRIDE;
107 virtual const SkBitmap& DownloadedProfileImage() const OVERRIDE; 108 virtual const SkBitmap& DownloadedProfileImage() const OVERRIDE;
108 109
109 // content::NotificationObserver implementation. 110 // content::NotificationObserver implementation.
110 virtual void Observe(int type, 111 virtual void Observe(int type,
111 const content::NotificationSource& source, 112 const content::NotificationSource& source,
112 const content::NotificationDetails& details) OVERRIDE; 113 const content::NotificationDetails& details) OVERRIDE;
113 114
114 // ProfileSyncServiceObserver implementation. 115 // ProfileSyncServiceObserver implementation.
115 virtual void OnStateChanged() OVERRIDE; 116 virtual void OnStateChanged() OVERRIDE;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // download times). 278 // download times).
278 void DownloadProfileData(const std::string& reason, bool download_image); 279 void DownloadProfileData(const std::string& reason, bool download_image);
279 280
280 // Scheduled call for downloading profile data. 281 // Scheduled call for downloading profile data.
281 void DownloadProfileDataScheduled(); 282 void DownloadProfileDataScheduled();
282 283
283 // Deletes user's image file. Runs on FILE thread. 284 // Deletes user's image file. Runs on FILE thread.
284 void DeleteUserImage(const FilePath& image_path); 285 void DeleteUserImage(const FilePath& image_path);
285 286
286 // Updates current user ownership on UI thread. 287 // Updates current user ownership on UI thread.
287 void UpdateOwnership(bool is_owner); 288 void UpdateOwnership(DeviceSettingsService::OwnershipStatus status,
289 bool is_owner);
288 290
289 // Checks current user's ownership on file thread. 291 // Triggers an asynchronous ownership check.
290 void CheckOwnership(); 292 void CheckOwnership();
291 293
292 // ProfileDownloaderDelegate implementation. 294 // ProfileDownloaderDelegate implementation.
293 virtual bool NeedsProfilePicture() const OVERRIDE; 295 virtual bool NeedsProfilePicture() const OVERRIDE;
294 virtual int GetDesiredImageSideLength() const OVERRIDE; 296 virtual int GetDesiredImageSideLength() const OVERRIDE;
295 virtual Profile* GetBrowserProfile() OVERRIDE; 297 virtual Profile* GetBrowserProfile() OVERRIDE;
296 virtual std::string GetCachedPictureURL() const OVERRIDE; 298 virtual std::string GetCachedPictureURL() const OVERRIDE;
297 virtual void OnProfileDownloadSuccess(ProfileDownloader* downloader) OVERRIDE; 299 virtual void OnProfileDownloadSuccess(ProfileDownloader* downloader) OVERRIDE;
298 virtual void OnProfileDownloadFailure(ProfileDownloader* downloader) OVERRIDE; 300 virtual void OnProfileDownloadFailure(ProfileDownloader* downloader) OVERRIDE;
299 301
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // been read from trusted device policy yet. 351 // been read from trusted device policy yet.
350 std::string owner_email_; 352 std::string owner_email_;
351 353
352 content::NotificationRegistrar registrar_; 354 content::NotificationRegistrar registrar_;
353 355
354 // Profile sync service which is observed to take actions after sync 356 // Profile sync service which is observed to take actions after sync
355 // errors appear. NOTE: there is no guarantee that it is the current sync 357 // errors appear. NOTE: there is no guarantee that it is the current sync
356 // service, so do NOT use it outside |OnStateChanged| method. 358 // service, so do NOT use it outside |OnStateChanged| method.
357 ProfileSyncService* observed_sync_service_; 359 ProfileSyncService* observed_sync_service_;
358 360
359 ObserverList<Observer> observer_list_; 361 ObserverList<UserManager::Observer> observer_list_;
360 362
361 // Download user profile image on login to update it if it's changed. 363 // Download user profile image on login to update it if it's changed.
362 scoped_ptr<ProfileDownloader> profile_image_downloader_; 364 scoped_ptr<ProfileDownloader> profile_image_downloader_;
363 365
364 // Arbitrary string passed to the last |DownloadProfileImage| call. 366 // Arbitrary string passed to the last |DownloadProfileImage| call.
365 std::string profile_image_download_reason_; 367 std::string profile_image_download_reason_;
366 368
367 // Time when the profile image download has started. 369 // Time when the profile image download has started.
368 base::Time profile_image_load_start_time_; 370 base::Time profile_image_load_start_time_;
369 371
(...skipping 17 matching lines...) Expand all
387 389
388 // Timer triggering DownloadProfileDataScheduled for refreshing profile data. 390 // Timer triggering DownloadProfileDataScheduled for refreshing profile data.
389 base::RepeatingTimer<UserManagerImpl> profile_download_timer_; 391 base::RepeatingTimer<UserManagerImpl> profile_download_timer_;
390 392
391 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl); 393 DISALLOW_COPY_AND_ASSIGN(UserManagerImpl);
392 }; 394 };
393 395
394 } // namespace chromeos 396 } // namespace chromeos
395 397
396 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_ 398 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698