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

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

Issue 15780020: Setup Sync to use OAuth token for managed users. (Closed) Base URL: http://git.chromium.org/chromium/src.git@issue226464a
Patch Set: fix 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_service.h
diff --git a/chrome/browser/managed_mode/managed_user_service.h b/chrome/browser/managed_mode/managed_user_service.h
index 43677d9524f59e5c0fd5795997754c845fda9c5e..a82a2ec29d035bb4d86599b53d256b27467421bf 100644
--- a/chrome/browser/managed_mode/managed_user_service.h
+++ b/chrome/browser/managed_mode/managed_user_service.h
@@ -14,6 +14,7 @@
#include "chrome/browser/extensions/management_policy.h"
#include "chrome/browser/managed_mode/managed_mode_url_filter.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/sync/profile_sync_service_observer.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -39,6 +40,7 @@ class PrefRegistrySyncable;
// manual whitelist/blacklist overrides).
class ManagedUserService : public BrowserContextKeyedService,
public extensions::ManagementPolicy::Provider,
+ public ProfileSyncServiceObserver,
public content::NotificationObserver {
public:
typedef std::vector<string16> CategoryList;
@@ -52,6 +54,9 @@ class ManagedUserService : public BrowserContextKeyedService,
explicit ManagedUserService(Profile* profile);
virtual ~ManagedUserService();
+ // ProfileKeyedService override:
+ virtual void Shutdown() OVERRIDE;
+
bool ProfileIsManaged() const;
// Checks whether the given profile is managed without constructing a
@@ -109,9 +114,9 @@ class ManagedUserService : public BrowserContextKeyedService,
// Marks the profile as managed and initializes it.
void InitForTesting();
- // Initializes this profile for syncing, using the provided |token| to
- // authenticate requests.
- void InitSync(const std::string& token);
+ // Initializes this profile for syncing, using the provided |refresh_token| to
+ // mint access tokens for Sync.
+ void InitSync(const std::string& refresh_token);
// Convenience method that registers this managed user with
// |registration_service| and initializes sync with the returned token.
@@ -138,6 +143,9 @@ class ManagedUserService : public BrowserContextKeyedService,
virtual bool UserMayModifySettings(const extensions::Extension* extension,
string16* error) const OVERRIDE;
+ // ProfileSyncServiceObserver implementation:
+ virtual void OnStateChanged() OVERRIDE;
+
// content::NotificationObserver implementation:
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -181,6 +189,8 @@ class ManagedUserService : public BrowserContextKeyedService,
const GoogleServiceAuthError& auth_error,
const std::string& token);
+ void SetupSync();
+
// Internal implementation for ExtensionManagementPolicy::Delegate methods.
// If |error| is not NULL, it will be filled with an error message if the
// requested extension action (install, modify status, etc.) is not permitted.
@@ -213,6 +223,9 @@ class ManagedUserService : public BrowserContextKeyedService,
content::NotificationRegistrar registrar_;
PrefChangeRegistrar pref_change_registrar_;
+ // True iff we're waiting for the Sync service to be initialized.
+ bool waiting_for_sync_initialization_;
+
// Sets a profile in elevated state for testing if set to true.
bool elevated_for_testing_;

Powered by Google App Engine
This is Rietveld 408576698