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

Unified Diff: chrome/browser/managed_mode/managed_user_registration_service.h

Issue 16950018: Collect the custodian's full name when a supervised user is created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/managed_mode/managed_user_registration_service.h
===================================================================
--- chrome/browser/managed_mode/managed_user_registration_service.h (revision 207746)
+++ chrome/browser/managed_mode/managed_user_registration_service.h (working copy)
@@ -13,6 +13,8 @@
#include "base/prefs/pref_change_registrar.h"
#include "base/strings/string16.h"
#include "base/timer.h"
+#include "chrome/browser/profiles/profile_downloader.h"
+#include "chrome/browser/profiles/profile_downloader_delegate.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "sync/api/syncable_service.h"
@@ -40,7 +42,8 @@
// management server and associating it with its custodian. It is owned by the
// custodian's profile.
class ManagedUserRegistrationService : public BrowserContextKeyedService,
- public syncer::SyncableService {
+ public syncer::SyncableService,
+ public ProfileDownloaderDelegate {
public:
// Callback for Register() below. If registration is successful, |token| will
// contain an OAuth2 refresh token for the newly registered managed user,
@@ -50,11 +53,26 @@
const std::string& /* token */)>
RegistrationCallback;
+ // Callback for DownloadProfile() below. If the GAIA profile download is
+ // successful, the profile's full (display) name will be returned.
+ typedef base::Callback<void(const string16& /* full name */)>
+ DownloadProfileCallback;
+
ManagedUserRegistrationService(
PrefService* prefs,
scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher);
virtual ~ManagedUserRegistrationService();
+ // ProfileDownloaderDelegate:
+ virtual bool NeedsProfilePicture() const OVERRIDE;
+ virtual int GetDesiredImageSideLength() const OVERRIDE;
+ virtual std::string GetCachedPictureURL() const OVERRIDE;
+ virtual Profile* GetBrowserProfile() OVERRIDE;
+ virtual void OnProfileDownloadSuccess(ProfileDownloader* downloader) OVERRIDE;
+ virtual void OnProfileDownloadFailure(
+ ProfileDownloader* downloader,
+ ProfileDownloaderDelegate::FailureReason reason) OVERRIDE;
+
static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
// Registers a new managed user with the server. |info| contains necessary
@@ -65,6 +83,13 @@
void Register(const ManagedUserRegistrationInfo& info,
const RegistrationCallback& callback);
+ // Downloads the GAIA account information for the |profile|. If the download
+ // is successful, the profile's full (display) name will be returned via the
+ // callback. If the download fails or never completes, the callback will
+ // not be called.
+ void DownloadProfile(Profile* profile,
Bernhard Bauer 2013/06/21 15:52:07 It's a bit weird that we have to pass in the profi
Pam (message me for reviews) 2013/06/21 16:19:09 Yeah, I don't know why the downloader doesn't take
+ const DownloadProfileCallback& callback);
+
// Cancels any registration currently in progress, without calling the
// callback or reporting an error. This should be called when the user
// actively cancels the registration by canceling profile creation.
@@ -114,6 +139,8 @@
void CompleteRegistration(bool run_callback,
const GoogleServiceAuthError& error);
+ void OnProfileDownloadComplete();
+
base::WeakPtrFactory<ManagedUserRegistrationService> weak_ptr_factory_;
PrefService* prefs_;
PrefChangeRegistrar pref_change_registrar_;
@@ -130,6 +157,10 @@
bool pending_managed_user_acknowledged_;
RegistrationCallback callback_;
+ Profile* download_profile_;
+ scoped_ptr<ProfileDownloader> profile_downloader_;
+ DownloadProfileCallback download_callback_;
+
DISALLOW_COPY_AND_ASSIGN(ManagedUserRegistrationService);
};

Powered by Google App Engine
This is Rietveld 408576698