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

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

Issue 16173008: Reland 203015 "Add ManagedUserTokenFetcher to fetch scoped-down ..." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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
diff --git a/chrome/browser/managed_mode/managed_user_registration_service.h b/chrome/browser/managed_mode/managed_user_registration_service.h
index fcdefb0f2eb491f5438068d82f8f2d7886bf6c42..d6f9221d00a23a0d6628d469cbd162effe9645ed 100644
--- a/chrome/browser/managed_mode/managed_user_registration_service.h
+++ b/chrome/browser/managed_mode/managed_user_registration_service.h
@@ -17,8 +17,13 @@
#include "sync/api/syncable_service.h"
class GoogleServiceAuthError;
+class ManagedUserRefreshTokenFetcher;
class PrefService;
+namespace browser_sync {
+class DeviceInfo;
+}
+
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -37,13 +42,17 @@ class ManagedUserRegistrationService : public BrowserContextKeyedService,
const std::string& /* token */)>
RegistrationCallback;
- explicit ManagedUserRegistrationService(PrefService* prefs);
+ ManagedUserRegistrationService(
+ PrefService* prefs,
+ scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher);
virtual ~ManagedUserRegistrationService();
static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
// Registers a new managed user with the server. |name| is the display name of
// the user. |callback| is called with the result of the registration.
+ // TODO(bauerb): There should be a way to cancel a pending managed user
+ // registration.
void Register(const string16& name, const RegistrationCallback& callback);
// Convenience method that registers a new managed user with the server and
@@ -77,8 +86,13 @@ class ManagedUserRegistrationService : public BrowserContextKeyedService,
// Called when the Sync server has acknowledged a newly created managed user.
void OnManagedUserAcknowledged(const std::string& managed_user_id);
+ // Fetches the managed user token when we have the device info.
+ void FetchToken(const string16& name,
+ const browser_sync::DeviceInfo& device_info);
+
// Called when we have received a token for the managed user.
- void OnReceivedToken(const std::string& token);
+ void OnReceivedToken(const GoogleServiceAuthError& error,
+ const std::string& token);
// Dispatches the callback if all the conditions have been met.
void DispatchCallbackIfReady();
@@ -94,6 +108,7 @@ class ManagedUserRegistrationService : public BrowserContextKeyedService,
base::WeakPtrFactory<ManagedUserRegistrationService> weak_ptr_factory_;
PrefService* prefs_;
PrefChangeRegistrar pref_change_registrar_;
+ scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher_;
scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
scoped_ptr<syncer::SyncErrorFactory> error_handler_;

Powered by Google App Engine
This is Rietveld 408576698